View source: R/summaryStatistics.R
countSites_cherryMethDiff | R Documentation |
This function calculates the number of methylation differences between pairs of cherry tips in a phylogenetic tree. A cherry is a pair of leaf nodes that share a direct common ancestor. The function quantifies full and half methylation differences for each genomic structure (e.g., island/non-island) across all sites.
countSites_cherryMethDiff(
cherryDist,
data,
categorized_data = FALSE,
input_control = TRUE
)
cherryDist |
A data frame containing pairwise distances between the tips of a phylogenetic tree that form cherries.
This should be as the output of
|
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. |
input_control |
A logical value indicating whether to validate the input data.
If |
The function first verifies that cherryDist
contains the required columns and has at least one row.
It also ensures that data
contains a sufficient number of tips and that all structures have the same number of sites.
The function then iterates over each cherry and genomic structure to compute the number of full and half methylation differences
between the two tips of each cherry.
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.
An integer count of the sites with a full methylation difference (where one tip is methylated and the other is unmethylated) for the given structure.
An integer count of the sites with a half methylation difference (where one tip is partially methylated and the other is either fully methylated or unmethylated) for the given structure.
# Example data setup
data <- list(
list(c(0, 1, 0.5, 0), c(1, 1, 0, 0.5)),
list(c(1, 0, 0.5, 1), c(0, 1, 0.5, 0.5))
)
tree <- "(tip1:0.25, tip2:0.25);"
cherryDist <- get_cherryDist(tree)
countSites_cherryMethDiff(cherryDist, data, categorized_data = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.