toMatching: Convert representation of a phylogenetic tree as a moment L-matrix to matching form
Description
Function converts a tree in moment format to matching format.
The input can be an L-matrix object,
a square L matrix,
or an L matrix in reduced upper-triangular (vector) form.
The toMatching function sets its list output to class L-matching,
which has 5 components,
including the tree in matching format.
Usage
toMatching(L, type = NULL, tip.label = NULL)
Value
a matching representation of the phylogenetic tree corresponding to the input
Arguments
L
An L-matrix object, a square L matrix,
or an L matrix in reduced upper-triangular (vector) form.
type
If object is not of class "L-matrix" and is a square L matrix,
then type should be "square'. If it is an L matrix in upper triangular form,
type should be "ut".
tip.label
Character vector containing labels for tips.
If null, labels default to "a"-"z" it at most 26; otherwise,
3-letter labels of the form "aaa", "aab",...
Author
Kem Phillips <kemphillips@comcast.net
Details
An L-matrix object is a list with 5 components: "L" is the L-matrix in square form. "L.ut" is the L-matrix in upper-triangular form. "Newick" is the Newick representation of the tree.
"tip.label" is the character vector of tip labels. "tip.label.n" is the number of tips.
References
K Phillips, Symbolic Computation of the Central Moments of the Multivariate Normal Distribution,
Journal of Statistical Software, 2010.
P.W. Diaconis and S. Holmes, Matchings and Phylogenetic Trees,
Proc. Natl. Acad. Sci., 1998,
95(25), 14600-14602
# create a Newick objectexam.Newick <- "(((a,b),c),d);"# convert to a moment L-matrixexam.moment <- toMoment(exam.Newick)
# convert to matching formatexam.matching <- toMatching(exam.moment)