Learn R Programming

Claddis (version 0.7.0)

permute_all_treeshape_labellings: Label treeshapes

Description

Given a treeshape and set of labels, permutes all possible labelled phylogenetic trees.

Usage

permute_all_treeshape_labellings(treeshapes, labels)

Value

A list of the same length as treeshapes composed of character vectors of labelled phylogenetic trees in the Newick format (Felsenstein 2004).

Arguments

treeshapes

A vector of treeshape(s) in the same format as permute_treeshapes.

labels

A character vector of tip labels to use for labelling.

Author

Graeme T. Lloyd graemetlloyd@gmail.com

Details

A treeshape is an unlabelled phylogenetic tree and as such can be labelled to produce a phylogenetic tree. This function takes a treeshape and a set of labels and generates (permutes) all possible labellings, i.e., all phylogenetic trees which a treeshape represents.

Note that the star tree always allows only a single labelling, whereas any more resolved treeshape will have multiple labellings.

Here treeshapes are encoded in the same pseudo-Newick format as the permute_treeshapes function, e.g.:

(((3),1),(1,(2)));

(Where each pair of parentheses represents an internal node, each number the number of tips, each comma separates sets of tips, and the semicolon denotes the root clade.)

References

Felsenstein, J., 2004. Inferring Phylogenies. Sinauer Associates, Inc., Sunderland.

Examples

Run this code

# Label some six-tip treeshapes with the letters A-F:
permute_all_treeshape_labellings(
  treeshapes = c(
    "(6);",
    "((3),(3));",
    "(1,(1,(1,(1,(2)))));"
  ),
  labels = LETTERS[1:6]
)

Run the code above in your browser using DataLab