]> git.donarmstrong.com Git - ape.git/blob - man/as.matching.Rd
ece8f32942bf49929bf68c5b5dc280f43e36d80b
[ape.git] / man / as.matching.Rd
1 \name{as.matching}
2 \alias{as.matching}
3 \alias{matching}
4 \alias{as.matching.phylo}
5 \alias{as.phylo.matching}
6 \title{Conversion Between Phylo and Matching Objects}
7 \description{
8   These functions convert objects between the classes \code{"phylo"} and
9   \code{"matching"}.
10 }
11 \usage{
12 as.matching(x, ...)
13 \method{as.matching}{phylo}(x, labels = TRUE, ...)
14 \method{as.phylo}{matching}(x, ...)
15 }
16 \arguments{
17   \item{x}{an object to convert as an object of class \code{"matching"}
18     or of class \code{"phylo"}.}
19   \item{labels}{a logical specifying whether the tip and node labels
20     should be included in the returned matching.}
21   \item{\dots}{further arguments to be passed to or from other methods.}
22 }
23 \details{
24   A matching is a representation where each tip and each node are given
25   a number, and sibling groups are grouped in a ``matching pair'' (see
26   Diaconis and Holmes 1998, for details). This coding system can be used
27   only for binary (fully dichotomous) trees.
28
29   Diaconis and Holmes (1998) gave some conventions to insure that a
30   given tree has a unique representation as a matching. I have tried to
31   follow them in the present functions.
32 }
33 \value{
34   \code{as.matching} returns an object of class \code{"matching"} with
35   the following component:
36
37   \item{matching}{a three-column numeric matrix where the first two
38     columns represent the sibling pairs, and the third one the
39     corresponding ancestor.}
40   \item{tip.label}{(optional) a character vector giving the tip labels
41     where the ith element is the label of the tip numbered i in
42     \code{matching}.}
43   \item{node.label}{(optional) a character vector giving the node
44     labels in the same order than in \code{matching} (i.e. the ith
45     element is the label of the node numbered i + n in \code{matching},
46     with n the number of tips).}
47
48   \code{as.phylo.matching} returns an object of class \code{"phylo"}.
49 }
50 \note{
51   Branch lengths are not supported in the present version.
52 }
53 \author{Emmanuel Paradis}
54 \references{
55   Diaconis, P. W. and Holmes, S. P. (1998) Matchings and phylogenetic
56   trees. \emph{Proceedings of the National Academy of Sciences USA},
57   \bold{95}, 14600--14602.
58 }
59 \seealso{\code{\link{as.phylo}}}
60 \examples{
61 data(bird.orders)
62 m <- as.matching(bird.orders)
63 str(m)
64 m
65 tr <- as.phylo(m)
66 all.equal(tr, bird.orders, use.edge.length = FALSE)
67 }
68 \keyword{manip}