computeFitch_islandGlbSt: Compute Fitch Parsimony for Global Methylation States at CpG...

View source: R/summaryStatistics.R

computeFitch_islandGlbStR Documentation

Compute Fitch Parsimony for Global Methylation States at CpG Islands

Description

This function categorizes CpG islands into methylation states and applies Fitch parsimony to estimate the minimum number of state changes in a phylogenetic tree.

Usage

computeFitch_islandGlbSt(
  index_islands,
  data,
  tree,
  u_threshold,
  m_threshold,
  testing = FALSE
)

Arguments

index_islands

A numeric vector specifying the indices of genomic structures corresponding to islands.

data

A list containing methylation states at tree tips, structured as data[[tip]][[structure]], where each tip has the same number of structures, and each structure has the same number of sites across tips.

tree

A rooted binary tree in Newick format (character string) or as an ape phylo object. Must have at least two tips.

u_threshold

A numeric threshold value (0-1) defining the unmethylated category.

m_threshold

A numeric threshold value (0-1) defining the methylated category.

testing

Logical; if TRUE, returns additional intermediate data.

Details

The function first validates the input data and categorizes CpG islands using categorize_islandGlbSt. It then structures the data into a matrix matching tree tip labels and applies compute_fitch to infer the minimum number of changes.

Value

If testing = TRUE, returns a list containing the categorized data matrix; otherwise, returns a numeric vector of minimum state changes.

Examples

tree <- "((a:1,b:1):2,(c:2,d:2):1.5);"

data <- list(
  list(rep(1,10), rep(0,5), rep(1,8)),
  list(rep(1,10), rep(0.5,5), rep(0,8))
)

index_islands <- c(1,3)

computeFitch_islandGlbSt(index_islands, data, tree, 0.2, 0.6)


MethEvolSIM documentation built on April 12, 2025, 1:30 a.m.