Learn R Programming

CollessLike (version 2.0)

cophen.vector: Computes the cophenetic vector of a phylogenetic tree

Description

Given a phylogenetic tree, computes the cophenetic vector of that phylogenetic tree.

Usage

cophen.vector(tree, set.of.labels = NULL)

Arguments

tree

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

set.of.labels

a list containing the set of labels of the tree (in the order of appearance from its newicks form). By default is NULL due to if tree is a phylo object or a newick string it is no necessary to specify it.

Value

A numeric array.

Details

The cophenetic vector is formed by all the cophenetic values between each pair of leaves. The cophenetic value of two different leaves i and j is the depth of the lowest common ancestor of the nodes in the tree labeled with i and j. If i=j, then the cophenetic value is the depth of that leaf.

References

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

G. Cardona, A. Mir, F. Rossello, L. Rotger, D. Sanchez, Cophenetic metrics for phylogenetic trees, after Sokal and Rohlf. BMC Bioinformatics 14 (2013), 3.

Examples

Run this code
# NOT RUN {
# Computation of the cophenetic vector of trees 
# entered in newick format:
cophen.vector("(1,2,3,4,5);")
cophen.vector("(1,(2,(3,(4,5))));")

# Computation of the cophenetic vector of trees 
# entered as a phylo object:
require(ape)
random.tree = rtree(5,rooted=TRUE)
cophen.vector(random.tree) 

# }

Run the code above in your browser using DataLab