Package 'TotalCopheneticIndex'

Title: Quantify the Balance of Phylogenetic Trees
Description: Measures the degree of balance for a given phylogenetic tree by calculating the Total Cophenetic Index. Reference: A. Mir, F. Rossello, L. A. Rotger (2013). A new balance index for phylogenetic trees. Math. Biosci. 241, 125-136 <doi:10.1016/j.mbs.2012.10.005>.
Authors: Martin R. Smith [aut, cre, cph]
Maintainer: Martin R. Smith <[email protected]>
License: Unlimited
Version: 2.0.1
Built: 2024-11-03 02:49:12 UTC
Source: https://github.com/cran/TotalCopheneticIndex

Help Index


List ancestors

Description

Reports the ancestors of a given node. Now simply a wrapper for TreeTools::ListAncestors().

Usage

list.ancestors(parent, child, node)

Arguments

parent

the 'parent' column of the edges property of a tree of class phylo;

child

the 'child' column of the edges property of a tree of class phylo;

node

the number of the node or tip whose ancestors are required.

Details

To observe the number of a node or tip, use plot(tree); nodelabels(); tiplabels();

Value

Returns a vector of the numbers of the nodes ancestral to the given node, including the root node.

Author(s)

Martin R. Smith

See Also

phangorn:::Ancestors, a less efficient implementation on which this code is based.

Examples

tree   <- ape::read.tree(text='(1, (2, (3, (4, 5))));')
  edge   <- tree$edge
  parent <- tree$edge[, 1]
  child  <- tree$edge[, 2]
  list.ancestors(parent, child, 4)

Total Cophenetic Index

Description

Calculate the Total Cophenetic Index for any tree. Now simply a wrapper for TreeTools::TotalCopheneticIndex().

Usage

tci(tree)

Arguments

tree

a tree of class phylo.

Details

The Total Cophenetic Index is a measure of tree balance - i.e. whether a (phylogenetic) tree comprises symmetric pairs of nodes, or has a pectinate 'caterpillar' shape. The index has a greater resolution power than Sackin's and Colless' indices, and can be applied to trees that are not perfectly resolved. Full details are provided by Mir et al. (2013).

Value

Returns the Total Cophenetic Index, a measure of the balance of the tree.

Author(s)

Martin R. Smith

References

A. Mir, F. Rossello, L. A. Rotger, A new balance index for phylogenetic trees. Math. Biosci. 241, 125-136 (2013).

See Also

The 'CollessLike' package (https://github.com/LuciaRotger/CollessLike) provides an alternative implementation of this index, and its predecessors. See its function cophen.index.

The range of possible values for a tree with n tips, and the values expected under simple models of evolution, is provided by tci.context(tree)

Examples

tree12 <- ape::read.tree(text='(1, (2, (3, (4, 5))));')  #Fig. 4, tree 12
  tci(tree12) # 10
  tree8  <- ape::read.tree(text='((1, 2, 3, 4), 5);')      #Fig. 4, tree 8
  tci(tree8)  # 6

Contextualize Total Cophenetic Index value

Description

Calculate the range of values that the Total Cophenetic Index can take, and expected values under the Yule and Uniform models of evolution. Now simply a wrapper for TreeTools::TCIContext().

Usage

tci.context(tree)
tci.context.n(n)

Arguments

tree

a tree of class phylo;

n

integer specifying the number of tips in a tree.

Details

For a tree with n tips, the Total Cophenetic Index can take values of 0 to choose(nTips, 3) The minimum value is higher for a perfectly resolved (i.e. dichotomous) tree (see Lemma 14) Formulae to calculate the expected values under the Yule and Uniform models of evolution are given in Theorems 17 and 23.

Value

A data frame detailing the maximum and minimum value obtainable for the Total Cophenetic Index for dichotomous trees with the number of tips of the given tree, and the expected value under the Yule and Uniform models. The variance of the expected value is given under the Yule model, but cannot be obtained by calculation for the Uniform model.

Author(s)

Martin R. Smith

References

A. Mir, F. Rossello, L. A. Rotger, A new balance index for phylogenetic trees. Math. Biosci. 241, 125-136 (2013).

See Also

tci, the Total Cophenetic Index for a given tree

Examples

tree12 <- ape::read.tree(text='(1, (2, (3, (4, 5))));')  #Fig. 4, tree 12
  tci(tree12)
  tci.context(tree12)
  tci.context.n(5) # For any tree with 5 tips