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 |
Reports the ancestors of a given node. Now simply a wrapper for TreeTools::ListAncestors()
.
list.ancestors(parent, child, node)
list.ancestors(parent, child, node)
parent |
the 'parent' column of the edges property of a tree of class |
child |
the 'child' column of the edges property of a tree of class |
node |
the number of the node or tip whose ancestors are required. |
To observe the number of a node or tip, use
plot(tree); nodelabels(); tiplabels();
Returns a vector of the numbers of the nodes ancestral to the given node
, including the root node.
Martin R. Smith
phangorn:::Ancestors
, a less efficient implementation on which this code is based.
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)
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)
Calculate the Total Cophenetic Index for any tree. Now simply a wrapper for TreeTools::TotalCopheneticIndex()
.
tci(tree)
tci(tree)
tree |
a tree of class |
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).
Returns the Total Cophenetic Index, a measure of the balance of the tree.
Martin R. Smith
A. Mir, F. Rossello, L. A. Rotger, A new balance index for phylogenetic trees. Math. Biosci. 241, 125-136 (2013).
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)
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
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
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()
.
tci.context(tree) tci.context.n(n)
tci.context(tree) tci.context.n(n)
tree |
a tree of class |
n |
integer specifying the number of tips in a tree. |
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.
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.
Martin R. Smith
A. Mir, F. Rossello, L. A. Rotger, A new balance index for phylogenetic trees. Math. Biosci. 241, 125-136 (2013).
tci
, the Total Cophenetic Index for a given tree
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
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