Learn R Programming

CollessLike (version 2.0)

balance.indices: Computes Colles-like, Sackin and cophenetic balance indices of a phylogenetic tree.

Description

Given a phylogenetic tree, computes Colles-like, Sackin and cophenetic balance indices of that tree.

Usage

balance.indices(tree, norm = FALSE, binary.Colless = FALSE)

Arguments

tree

a single phylogenetic tree. It can be entered as a string in Newick format, as a 'phylo' object (ape package) or as an 'igraph' object (igraph package).

norm

a logical variable that indicates whether the indices should be normalized or not.

binary.Colless

a logical variable FALSE by default. If is TRUE then the classical Colless index is computed (only for binary trees).

Value

A numeric vector with the three computed balance indices of the tree: Colless-like, Sackin and Cophenetic values.

Details

The Colless-like index is the generalization of the Colless' index for non-binary trees (see Mir et al. , 2018).

The Sackin's index is computed as the sum of the number of ancestors for each leave of the tree (see Mir et al. , 2013).

The cophenetic index is computed as the sum of the depths of the least common ancestor (LCA) of every pair of leaves of the tree(see Sackin et al, 1972).

References

A. Mir, F. Rossello, L.Rotger, Sound Colless-like balance indices for multifurcating phylogenetic trees.PloS ONE 13 (2018), e0203401.

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

M. J. Sackin, "Good" and "bad" phenograms. Sys. Zool, 21 (1972), 225-226.

Examples

Run this code
# NOT RUN {
# Computation of the Colless-Like, Sackin and Cophenetic 
# balance indices of trees entered in newick format:
balance.indices("(1,2,3,4,5);")
balance.indices("(1,(2,(3,(4,5))));")

# Computation of the Colless-Like, Sackin and Cophenetic
# balance indices of a tree entered as a phylo object:
require(ape)
random.tree = rtree(5,rooted=TRUE)
balance.indices(random.tree)

# Computation of the Colless-Like, Sackin and Cophenetic 
# balance indices of a tree entered as a igraph object.
# The tree is randomly generated from all trees with 5
# leaves following the alpha-gamma model with alpha=0.5
# and gamma=0.3.
a.g.tree = a.g.model(5,0.5,0.3)
balance.indices(a.g.tree)

# All of them can be normalized (values between 0 and 1)
balance.indices("(1,2,3,4,5);",norm=TRUE)
balance.indices("(1,(2,(3,(4,5))));",norm=TRUE)
balance.indices(random.tree,norm=TRUE)
balance.indices(a.g.tree,norm=TRUE)

# }

Run the code above in your browser using DataLab