toMatching: Convert a Phylogenetic Tree from a Moment L-Matrix to...

toMatchingR Documentation

Convert a Phylogenetic Tree from a Moment L-Matrix to Matching Form

Description

Converts a tree structure represented in a moment format into an ape matching format structure.

Usage

toMatching(L, type = NULL, tip.label = NULL)

Arguments

L

The input tree structure. This can be an L-matrix object, a square L matrix, or an L matrix in reduced upper-triangular (vector) form.

type

A character string, either 'square' or 'ut'. This must be specified if L is a raw matrix or vector rather than a formal L-matrix object. Defaults to NULL.

tip.label

A character vector containing custom labels for the tips. If NULL (the default), labels fallback to "a" through "z" if there are at most 26 tips; otherwise, 3-letter combinations of the form "aaa", "aab", etc., are generated.

Details

An L-matrix object is a list containing the following 5 components:

  • L: The L-matrix in full square form.

  • L.ut: The L-matrix in reduced upper-triangular form.

  • Newick: The Newick string representation of the tree structure.

  • tip.label: A character vector of the tip labels.

  • tip.label.n: An integer specifying the total number of tips.

Value

A matching representation of the phylogenetic tree corresponding to the input. The output list is assigned the class 'L-matching', which contains 5 components including the tree in matching format.

Author(s)

Kem Phillips kemphillips@comcast.net

References

\insertRef

Phillips2010symmoments

\insertRefDiaconis1998symmoments

See Also

toMoment, toNewick

Examples

# Create a Newick character string
exam.Newick <- "(((a,b),c),d);"

# Convert to a moment L-matrix
exam.moment <- toMoment(exam.Newick)

# Convert to matching format
exam.matching <- toMatching(exam.moment)


symmoments documentation built on May 27, 2026, 9:06 a.m.