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