as.matching: Conversion Between Phylo and Matching Objects

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

These functions convert objects between the classes "phylo" and "matching".

Usage

1
2
3
4
5
as.matching(x, ...)
## S3 method for class 'phylo'
as.matching(x, labels = TRUE, ...)
## S3 method for class 'matching'
as.phylo(x, ...)

Arguments

x

an object to convert as an object of class "matching" or of class "phylo".

labels

a logical specifying whether the tip and node labels should be included in the returned matching.

...

further arguments to be passed to or from other methods.

Details

A matching is a representation where each tip and each node are given a number, and sibling groups are grouped in a “matching pair” (see Diaconis and Holmes 1998, for details). This coding system can be used only for binary (fully dichotomous) trees.

Diaconis and Holmes (1998) gave some conventions to insure that a given tree has a unique representation as a matching. I have tried to follow them in the present functions.

Value

as.matching returns an object of class "matching" with the following component:

matching

a three-column numeric matrix where the first two columns represent the sibling pairs, and the third one the corresponding ancestor.

tip.label

(optional) a character vector giving the tip labels where the ith element is the label of the tip numbered i in matching.

node.label

(optional) a character vector giving the node labels in the same order than in matching (i.e. the ith element is the label of the node numbered i + n in matching, with n the number of tips).

as.phylo.matching returns an object of class "phylo".

Note

Branch lengths are not supported in the present version.

Author(s)

Emmanuel Paradis

References

Diaconis, P. W. and Holmes, S. P. (1998) Matchings and phylogenetic trees. Proceedings of the National Academy of Sciences USA, 95, 14600–14602.

See Also

as.phylo

Examples

1
2
3
4
5
6
data(bird.orders)
m <- as.matching(bird.orders)
str(m)
m
tr <- as.phylo(m)
all.equal(tr, bird.orders, use.edge.length = FALSE)

gjuggler/ape documentation built on May 17, 2019, 6:03 a.m.