permute_all_treeshape_labellings: Label treeshapes

View source: R/permute_all_treeshape_labellings.r

permute_all_treeshape_labellingsR Documentation

Label treeshapes

Description

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

Usage

permute_all_treeshape_labellings(treeshapes, labels)

Arguments

treeshapes

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

labels

A character vector of tip labels to use for labelling.

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 linkpermute_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.)

Value

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

Author(s)

Graeme T. Lloyd graemetlloyd@gmail.com

References

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

Examples


# 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]
)


graemetlloyd/Claddis documentation built on May 9, 2024, 8:07 a.m.