Package: ape
Version: 3.0-6
-Date: 2012-08-17
+Date: 2012-10-12
Title: Analyses of Phylogenetics and Evolution
Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, Christoph Heibl, Daniel Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, Yvonnick Noel, Johan Nylander, Rainer Opgen-Rhein, Andrei-Alin Popescu, Klaus Schliep, Korbinian Strimmer, Damien de Vienne
Maintainer: Emmanuel Paradis <Emmanuel.Paradis@ird.fr>
index.only = TRUE to return only the vector of indices (the tree
is unmodified, see ?reorder.phylo for details).
- o The three new functions node.depth.length, node.height, and
+ o The three new functions node.depth.edgelength, node.height, and
node.height.clado make some internal code available from R. See
?node.depth (which was already available and documented) for
details.
o reorder(, "pruningwise") made R crash if the rows of the edge
matrix are in random order: this is now fixed.
+ o drop.tip() sometimes shuffled node labels (thanks to Rebecca Best
+ for the report).
+
OTHER CHANGES
-## drop.tip.R (2011-11-21)
+## drop.tip.R (2012-10-06)
## Remove Tips in a Phylogenetic Tree
-## Copyright 2003-2011 Emmanuel Paradis
+## Copyright 2003-2012 Emmanuel Paradis
## This file is part of the R-package `ape'.
## See the file ../COPYING for licensing issues.
phy$tip.label <- c(phy$tip.label, new.tip.label)
}
- ## update node.label if needed:
- if (!is.null(phy$node.label))
- phy$node.label <- phy$node.label[sort(unique(phy$edge[, 1])) - Ntip]
-
phy$Nnode <- dim(phy$edge)[1] - n + 1L # update phy$Nnode
## The block below renumbers the nodes so that they conform
- ## to the "phylo" format -- same as in root()
+ ## to the "phylo" format, same as in root()
newNb <- integer(n + phy$Nnode)
newNb[NEWROOT] <- n + 1L
sndcol <- phy$edge[, 2] > n
(n + 2):(n + phy$Nnode)
phy$edge[, 1] <- newNb[phy$edge[, 1]]
storage.mode(phy$edge) <- "integer"
+ if (!is.null(phy$node.label)) { # update node.label if needed
+ newNb[is.na(newNb)] <- 0L
+ phy$node.label <- phy$node.label[order(newNb[newNb > 0])]
+ }
collapse.singles(phy)
}
-## reorder.phylo.R (2012-09-03)
+## reorder.phylo.R (2012-10-12)
## Internal Reordering of Trees
io <- pmatch(order, ORDER)
if (is.na(io)) stop("ambiguous order")
order <- ORDER[io]
+ nb.edge <- dim(x$edge)[1]
if (!is.null(attr(x, "order")))
- if (attr(x, "order") == order) return(x)
+ if (attr(x, "order") == order)
+ if (index.only) return(1:nb.edge) else return(x)
nb.node <- x$Nnode
if (nb.node == 1) return(x)
nb.tip <- length(x$tip.label)
- nb.edge <- dim(x$edge)[1]
if (io == 3) {
x <- reorder(x)
neworder <-
\alias{AIC.ace}
\alias{anova.ace}
\title{Ancestral Character Estimation}
+\description{
+ This function estimates ancestral character states, and the associated
+ uncertainty, for continuous and discrete characters.
+
+ \code{logLik}, \code{deviance}, and \code{AIC} are generic functions
+ used to extract the log-likelihood, the deviance, or the Akaike
+ information criterion of a fitted object. If no such values are
+ available, \code{NULL} is returned.
+
+ \code{anova} is another generic function which is used to compare
+ nested models: the significance of the additional parameter(s) is
+ tested with likelihood ratio tests. You must ensure that the models
+ are effectively nested (if they are not, the results will be
+ meaningless). It is better to list the models from the smallest to the
+ largest.
+}
\usage{
ace(x, phy, type = "continuous", method = "ML", CI = TRUE,
model = if (type == "continuous") "BM" else "ER",
information criterion.}
\item{\dots}{further arguments passed to or from other methods.}
}
-\description{
- This function estimates ancestral character states, and the associated
- uncertainty, for continuous and discrete characters.
-
- \code{logLik}, \code{deviance}, and \code{AIC} are generic functions
- used to extract the log-likelihood, the deviance (-2*logLik), or the
- Akaike information criterion of a tree. If no such values are
- available, \code{NULL} is returned.
-
- \code{anova} is another generic function which is used to compare
- nested models: the significance of the additional parameter(s) is
- tested with likelihood ratio tests. You must ensure that the models
- are effectively nested (if they are not, the results will be
- meaningless). It is better to list the models from the smallest to the
- largest.
-}
\details{
If \code{type = "continuous"}, the default model is Brownian motion
where characters evolve randomly following a random walk. This model
given through a correlation structure with the option
\code{corStruct}.
- In the default setting (i.e., \code{method = "ML"} and \code{model =
- "BM"}) the maximum likelihood estimation is done simultaneously on the
+ In the default setting (\code{method = "ML"} and \code{model = "BM"})
+ the maximum likelihood estimation is done simultaneously on the
ancestral values and the variance of the Brownian motion process;
these estimates are then used to compute the confidence intervals in
the standard way. The REML method first estimates the ancestral value
It could be shown that, with a continous character, REML results in
unbiased estimates of the variance of the Brownian motion process
- while ML gives a downward bias. Therefore, the former is recommanded
- over the latter, even though it is not the default.
+ while ML gives a downward bias. Therefore the former is recommanded,
+ even though it is not the default.
For discrete characters (\code{type = "discrete"}), only maximum
likelihood estimation is available (Pagel 1994). The model is
is determined from the data.
}
\value{
- a list with the following elements:
+ an object of class \code{"ace"} with the following elements:
\item{ace}{if \code{type = "continuous"}, the estimates of the
ancestral character values.}
Likelihood of ancestor states in adaptive radiation. \emph{Evolution},
\bold{51}, 1699--1711.
}
-\author{Emmanuel Paradis, Ben Bolker \email{bolker@zoo.ufl.edu}}
+\author{Emmanuel Paradis, Ben Bolker}
\seealso{
\code{\link{corBrownian}}, \code{\link{corGrafen}},
\code{\link{corMartins}}, \code{\link{compar.ou}},
\value{
an object of class \code{"phylo"}.
}
-\author{Ben Bolker \email{bolker@zoo.ufl.edu}}
+\author{Ben Bolker}
\seealso{
\code{\link{plot.phylo}}, \code{\link{read.tree}}
}
\item{x}{a matrix or a list containing the DNA sequences; this must be
of class \code{"DNAbin"} (use \code{\link{as.DNAbin}} is they are
stored as character).}
- \item{model}{a character string specifying the evlutionary model to be
+ \item{model}{a character string specifying the evolutionary model to be
used; must be one of \code{"raw"}, \code{"N"}, \code{"TS"},
\code{"TV"}, \code{"JC69"}, \code{"K80"} (the default),
\code{"F81"}, \code{"K81"}, \code{"F84"}, \code{"BH87"},
\item{variance}{a logical indicating whether to compute the variances
of the distances; defaults to \code{FALSE} so the variances are not
computed.}
- \item{gamma}{a value for the gamma parameter which is possibly used to
- apply a gamma correction to the distances (by default \code{gamma =
- FALSE} so no correction is applied).}
+ \item{gamma}{a value for the gamma parameter possibly used to apply a
+ correction to the distances (by default no correction is applied).}
\item{pairwise.deletion}{a logical indicating whether to delete the
sites with missing data in a pairwise way. The default is to delete
the sites with at least one missing data for all sequences (ignored
if \code{model = "indel"} or \code{"indelblock"}).}
\item{base.freq}{the base frequencies to be used in the computations
- (if applicable, i.e. if \code{method = "F84"}). By default, the
- base frequencies are computed from the whole sample of sequences.}
+ (if applicable). By default, the base frequencies are computed from
+ the whole set of sequences.}
\item{as.matrix}{a logical indicating whether to return the results as
a matrix. The default is to return an object of class
\link[stats]{dist}.}
\item{\code{paralin}: }{Lake (1994) developed the paralinear distance which
can be viewed as another variant of the Barry--Hartigan distance.}
- \item{\code{indel}: }{this counts the number of sites where there an
+ \item{\code{indel}: }{this counts the number of sites where there is an
insertion/deletion gap in one sequence and not in the other.}
\item{\code{indelblock}: }{same than before but contiguous gaps are
- counted as a single unit. Note that the distance between `-A-' and
- `A--' is 3 because there are three different blocks of gaps, whereas
+ counted as a single unit. Note that the distance between \code{-A-} and
+ \code{A--} is 3 because there are three different blocks of gaps, whereas
the ``indel'' distance will be 2.}
}}
\value{
London: Chapman & Hall.
}
\author{
- Original code in S by Ben Bolker \email{bolker@zoo.ufl.edu}, ported
- to \R by Julien Claude \email{claude@isem.univ-montp2.fr}
+ Original code in S by Ben Bolker, ported to \R by Julien Claude
}
\examples{
q1 <- matrix(runif(36), nrow = 6)
\name{node.depth}
\alias{node.depth}
-\alias{node.depth.length}
+\alias{node.depth.edgelength}
\alias{node.height}
\alias{node.height.clado}
\title{Depth and Heights of Nodes and Tips}
}
\usage{
node.depth(phy)
-node.depth.length(phy)
+node.depth.edgelength(phy)
node.height(phy)
node.height.clado(phy)
}
\code{node.depth} computes the depth of a node as the number of tips
which are its descendants. The value of 1 is given to the tips.
- \code{node.depth.length} does the same but using branch lengths.
+ \code{node.depth.edgelength} does the same but using branch lengths.
\code{node.height} computes the heights of nodes and tips as plotted
by a phylogram.
\code{show.tip.label}) of \code{plot.phylo} in most cases (see the
examples).
}
-\author{Emmanuel Paradis, Ben Bolker \email{bolker@zoo.ufl.edu}, and Jim
- Lemon}
+\author{Emmanuel Paradis, Ben Bolker, and Jim Lemon}
\seealso{
\code{\link{plot.phylo}}, \code{\link{edges}},
\code{\link{mixedFontLabel}}
\item{plot}{a logical controlling whether to draw the tree. If
\code{FALSE}, the graphical device is set as if the tree was
plotted, and the coordinates are saved as well.}
- \item{layout}{the number of trees to be plotted simultaneously.}
- \item{\dots}{further arguments to be passed to \code{plot} or to
- \code{plot.phylo}.}
\item{rotate.tree}{for "fan", "unrooted", or "radial" trees: the
rotation of the whole tree in degrees (negative values are
accepted).}
+ \item{layout}{the number of trees to be plotted simultaneously.}
+ \item{\dots}{further arguments to be passed to \code{plot} or to
+ \code{plot.phylo}.}
}
\description{
These functions plot phylogenetic trees on the current graphical
\value{
NULL.
}
-\author{Ben Bolker \email{bolker@zoo.ufl.edu} and Emmanuel Paradis}
+\author{Ben Bolker and Emmanuel Paradis}
\seealso{
\code{\link{read.tree}}, \code{\link{summary.phylo}},
\code{\link[base]{print}} for the generic \R function
Read a tree from a file in the format used by the CAIC and MacroCAIc program.
}
\value{
-an object of class "phylo" with the following components:
-\item{edge}{a two-column matrix of mode character where each row represents an edge of the tree; the nodes and the tips are symbolized with numbers (these numbers are not treated as numeric, hence the mode character); the nodes are represented with negative numbers (the root being "-1"), and the tips are represented with positive numbers. For each row, the first column gives the ancestor. This representation allows an easy manipulation of the tree, particularly if it is rooted.}
-\item{edge.length}{a numeric vector giving the lengths of the branches given by edge.}
-\item{tip.label}{a vector of mode character giving the names of the tips; the order of the names in this vector corresponds to the (positive) number in edge.}
-\item{node.label}{(optional) a vector of mode character giving the names of the nodes (set to NULL if not available in the file).}
-\item{root.edge}{(optional) a numeric value giving the length of the branch at the root is it exists (NULL otherwise).}
+ an object of class \code{"phylo"}.
}
\references{
Purvis, A. and Rambaut, A. (1995) Comparative analysis by independent
\item{file}{a file name specified by either a variable of mode character,
or a double-quoted string.}
\item{tree.names}{if there are several trees to be read, a vector of
- mode character that gives names to the individual trees.}
+ mode character giving names to the individual trees (by default,
+ this uses the labels in the NEXUS file if these are present).}
}
\description{
This function reads one or several trees in a NEXUS file.
NEXUS standard (but see the restriction below on TRANSLATION
tables). Only the block ``TREES'' is read; the other data can be read
with other functions (e.g., \code{\link{read.dna}},
- \code{\link[utils]{read.table}}, ...). A trace of the original data is
- kept with the attribute \code{"origin"} (see below).
+ \code{\link[utils]{read.table}}, \dots).
If a TRANSLATION table is present it is assumed that only the tip
labels are translated and they are all translated with integers
message is issued.
}
\value{
- an object of class \code{"phylo"} with the following components:
- \item{edge}{a two-column matrix of mode character where each row
- represents an edge of the tree; the nodes and the tips are
- symbolized with numbers (these numbers are not treated as numeric,
- hence the mode character); the nodes are represented with negative
- numbers (the root being \code{"-1"}), and the tips are represented with
- positive numbers. For each row, the first column gives the
- ancestor. This representation allows an easy manipulation of the
- tree, particularly if it is rooted.}
- \item{edge.length}{a numeric vector giving the lengths of the
- branches given by \code{edge}.}
- \item{tip.label}{a vector of mode character giving the names of the
- tips; the order of the names in this vector corresponds to the
- (positive) number in \code{edge}.}
- \item{node.label}{(optional) a vector of mode character giving the
- names of the nodes (set to \code{NULL} if not available in the file).}
- \item{root.edge}{(optional) a numeric value giving the length of the
- branch at the root is it exists (\code{NULL} otherwise).}
-
- If several trees are read in the file, the returned object is of class
- \code{"multiPhylo"}, and is a list of objects of class \code{"phylo"}.
+ an object of class \code{"phylo"} or of class \code{"multiPhylo"}.
}
\references{
Maddison, D. R., Swofford, D. L. and Maddison, W. P. (1997) NEXUS: an
}
\source{
Michaux, J. R., Magnanou, E., Paradis, E., Nieberding, C. and Libois,
- R. (2003) Mitochondrial phylogeography of the Woodmouse (Apodemus
- sylvaticus) in the Western Palearctic region. \emph{Molecular
- Ecology}, \bold{12}, 685--697.
+ R. (2003) Mitochondrial phylogeography of the Woodmouse
+ (\emph{Apodemus sylvaticus}) in the Western Palearctic region.
+ \emph{Molecular Ecology}, \bold{12}, 685--697.
}
\seealso{
\code{\link{read.dna}}, \code{\link{DNAbin}}, \code{\link{dist.dna}}
edge in the calculations.}
}
\description{
- This function fits by maximum likelihood a Yule model, i.e. a
+ This function fits by maximum likelihood a Yule model, i.e., a
birth-only model to the branching times computed from a phylogenetic
tree.
}