View source: R/summaryStatistics.R
MeanSiteFChange_cherry | R Documentation |
This function calculates the weighted mean frequency of methylation changes at island and non-island genomic structures for each cherry in a phylogenetic tree. A cherry is a pair of leaf nodes (also called tips or terminal nodes) in a phylogenetic tree that share a direct common ancestor.
MeanSiteFChange_cherry(
data,
categorized_data = FALSE,
tree,
index_islands,
index_nonislands
)
data |
A list containing methylation states at tree tips for each genomic structure (e.g., island/non-island).
The data should be structured as |
categorized_data |
Logical defaulted to FALSE. TRUE to skip redundant categorization when methylation states are represented as 0, 0.5, and 1. |
tree |
A phylogenetic tree in Newick format or a |
index_islands |
A numeric vector specifying the indices of genomic structures corresponding to islands. |
index_nonislands |
A numeric vector specifying the indices of genomic structures corresponding to non-islands. |
The function first validates the tree and the input data structure. It then computes the
per-cherry frequency of sites with different methylation states using get_siteFChange_cherry
.
The indices provided for islands and non-islands are checked for validity using validate_structureIndices
.
Finally, the function calculates the weighted mean site frequency of methylation changes for each cherry,
separately for islands and non-islands.
A data frame with one row per cherry, containing the following columns:
A character string representing the names of the two tips in the cherry, concatenated with a hyphen.
A character string representing the indices of the two tips in the cherry, concatenated with a hyphen.
A numeric value representing the sum of the branch distances between the cherry tips.
A numeric value representing the weighted mean frequency of methylation changes in non-island structures.
A numeric value representing the weighted mean frequency of methylation changes in island structures.
# Example data setup
data <- list(
list(rep(1,10), rep(0,5), rep(1,8)), # Tip a
list(rep(1,10), rep(0.5,5), rep(0,8)), # Tip b
list(rep(1,10), rep(0.5,5), rep(0,8)), # Tip c
list(c(rep(0,5), rep(0.5, 5)), c(0, 0, 1, 1, 1), c(0.5, 1, rep(0, 6)))) # Tip d
tree <- "((a:1.5,b:1.5):2,(c:2,d:2):1.5);"
index_islands <- c(1,3)
index_nonislands <- c(2)
MeanSiteFChange_cherry(data = data,
categorized_data = TRUE,
tree = tree,
index_islands = index_islands,
index_nonislands = index_nonislands)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.