compute_fitch: Compute Fitch Parsimony for Methylation Categories

View source: R/summaryStatistics.R

compute_fitchR Documentation

Compute Fitch Parsimony for Methylation Categories

Description

This function applies Fitch parsimony to determine the minimum number of changes required for methylation categories at tree tips.

Usage

compute_fitch(tree, meth, input_control = TRUE)

Arguments

tree

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

meth

A matrix of methylation categories at the tree tips, with rows corresponding to tips (names matching tree tip labels) and columns corresponding to sites or structures.

input_control

Logical; if TRUE, validates input consistency.

Value

A list containing:

optStateSet

A list of sets of optimal states for the root at each site/structure.

minChange_number

A numeric vector indicating the minimum number of changes for each site.

Examples

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

meth <- matrix(c("u", "m", "p", "u", "p", "m", "m", "u"), 
               nrow=4, byrow=TRUE, dimnames=list(c("a", "b", "c", "d")))
               
compute_fitch(tree, meth)


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