View source: R/summaryStatistics.R
| mean_TreeFreqsChange_i | R Documentation | 
This function analyzes the frequency changes of methylation states (unmethylated, partially methylated, methylated) across tree tips for a given set of islands. It performs a chi-squared test for each island to check for significant changes in frequencies across tips and returns the proportion of islands showing significant changes.
mean_TreeFreqsChange_i(
  tree,
  data,
  categorized_data = FALSE,
  index_islands,
  pValue_threshold,
  testing = FALSE
)
| tree | A phylogenetic tree object, typically of class  | 
| 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. | 
| index_islands | A vector of indices of genomic structures corresponding to islands in data. | 
| pValue_threshold | A numeric value between 0 and 1 that serves as the threshold for statistical significance in the chi-squared test. | 
| testing | Logical defaulted to FALSE. TRUE for testing output. | 
The function uses simulate.p.value = TRUE in chisq.test
to compute the p-value via Monte Carlo simulation to improve reliability
regardless of whether the expected frequencies meet the assumptions of the chi-squared test
(i.e., expected counts of at least 5 in each category).
Throws errors if:
 The tree is not valid.
data is not structured correctly across tips.
index_islands is empty.
pValue_threshold is not between 0 and 1.
A numeric value representing the mean proportion of islands with significant frequency changes across tips.
# Example of usage:
tree <- "((d:1,e:1):2,a:2);"
data <- list(
  #Tip 1
  list(c(rep(1,9), rep(0,1)), 
       c(rep(0,9), 1), 
       c(rep(0,9), rep(0.5,1))), 
  #Tip 2
  list(c(rep(1,9), rep(0.5,1)), 
       c(rep(0.5,9), 1), 
       c(rep(1,9), rep(0,1))), 
  #Tip 3
  list(c(rep(1,9), rep(0.5,1)), 
       c(rep(0.5,9), 1), 
       c(rep(0,9), rep(0.5,1)))) 
       
index_islands <- c(1,3)
mean_TreeFreqsChange_i(tree, 
                       data, categorized_data = TRUE,
                       index_islands, 
                       pValue_threshold = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.