]> git.donarmstrong.com Git - ape.git/commitdiff
some changes for ape 3.0-6
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Fri, 12 Oct 2012 07:56:32 +0000 (07:56 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Fri, 12 Oct 2012 07:56:32 +0000 (07:56 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@197 6e262413-ae40-0410-9e79-b911bd7a66b7

16 files changed:
DESCRIPTION
NEWS
R/drop.tip.R
R/reorder.phylo.R
man/ace.Rd
man/collapse.singles.Rd
man/dist.dna.Rd
man/mantel.test.Rd
man/node.depth.Rd
man/nodelabels.Rd
man/plot.phylo.Rd
man/print.phylo.Rd
man/read.caic.Rd
man/read.nexus.Rd
man/woodmouse.Rd
man/yule.Rd

index 03b6257e9bc727907847fc62821b247b5e9e722b..32f124c030a017abadeee6736547768327ab1d7f 100644 (file)
@@ -1,6 +1,6 @@
 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>
diff --git a/NEWS b/NEWS
index 729e3ed930e14e4404d261978374069c41576c6c..6ba9bc404c66d08cc4799337a6b0aa49b8d4a685 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,7 +7,7 @@ NEW FEATURES
       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.
@@ -18,6 +18,9 @@ BUG FIXES
     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
 
index 5b635f680f4459a579242dfc4fdf2c549d9b5f22..e9bd5c037364f4f8e20604ac3aff8ae6755a7b16 100644 (file)
@@ -1,8 +1,8 @@
-## 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.
@@ -208,14 +208,10 @@ drop.tip <-
         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
@@ -224,6 +220,10 @@ drop.tip <-
         (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)
 }
 
index ee9e9e0dcf703f7da186d125f82a8f14c26b1758..e717eb26c2583c6d3cf0e371f289538c851d6ac2 100644 (file)
@@ -1,4 +1,4 @@
-## reorder.phylo.R (2012-09-03)
+## reorder.phylo.R (2012-10-12)
 
 ##   Internal Reordering of Trees
 
@@ -13,12 +13,13 @@ reorder.phylo <- function(x, order = "cladewise", index.only = FALSE, ...)
     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 <-
index 96860220b2cef50008075f1abe6f72afff7ffac7..15bd38758e42de2c7ede2fb709125350ced28b62 100644 (file)
@@ -6,6 +6,22 @@
 \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",
@@ -47,22 +63,6 @@ ace(x, phy, type = "continuous", method = "ML", CI = TRUE,
     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
@@ -74,8 +74,8 @@ ace(x, phy, type = "continuous", method = "ML", CI = TRUE,
   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
@@ -89,8 +89,8 @@ ace(x, phy, type = "continuous", method = "ML", CI = TRUE,
 
   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
@@ -110,7 +110,7 @@ ace(x, phy, type = "continuous", method = "ML", CI = TRUE,
   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.}
@@ -153,7 +153,7 @@ ace(x, phy, type = "continuous", method = "ML", CI = TRUE,
   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}},
index cd6e8b6b6a8a8e351dd35a995d016a6103ee724e..ecfa0ec164ad6ff92534223b57b9e083d9276624 100644 (file)
@@ -14,7 +14,7 @@ collapse.singles(tree)
 \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}}
 }
index bc5d4858a46ad3cf6a28fb1ce043731f25926d73..81686032b1cf0e65206ea317ca93630c6ddfa880 100644 (file)
@@ -10,7 +10,7 @@ dist.dna(x, model = "K80", variance = FALSE,
   \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"},
@@ -19,16 +19,15 @@ dist.dna(x, model = "K80", variance = FALSE,
   \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}.}
@@ -123,12 +122,12 @@ dist.dna(x, model = "K80", variance = FALSE,
   \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{
index 949678e7021bfb94f1ee378f1925600b67a3a134..07dfc395858fc259d53c38910f5e04b421298d3d 100644 (file)
@@ -55,8 +55,7 @@ mantel.test(m1, m2, nperm = 999, graph = FALSE,
   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)
index e4c7bf9bcecf6b812634ef14ad3c8d9aa5458098..0741c7a4779871d500b1b7f09a4bbf9b00a4c9c3 100644 (file)
@@ -1,6 +1,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}
@@ -9,7 +9,7 @@
 }
 \usage{
 node.depth(phy)
-node.depth.length(phy)
+node.depth.edgelength(phy)
 node.height(phy)
 node.height.clado(phy)
 }
@@ -20,7 +20,7 @@ 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.
index c49969433f2f3d0af61a2ebc459f09e4d6e44187..5c44f3f74d54941c5d8100ce626807a9f198281b 100644 (file)
@@ -88,8 +88,7 @@ edgelabels(text, edge, adj = c(0.5, 0.5), frame = "rect",
   \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}}
index f19db415317559caa2c338cf9d3b677b6ad6d3db..ee8928771a7a5e0e4962f2b3f9b13c148437fb7a 100644 (file)
   \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
index 91917f8b3fb598409ec320ebfc74d66869afeecb..f1ad30609f7f1085f6ec18e4821f9474434878f0 100644 (file)
@@ -23,7 +23,7 @@
 \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
index 016d8a6cd64c98a241e2880688c2cd3d1084b570..39bc2a1df1a685a30f7d0491927b639955315130 100644 (file)
@@ -19,12 +19,7 @@ read.caic(file, brlen = NULL, skip = 0, comment.char = "#", ...)
   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
index 8a668d1e2db0e8eaf502dd8efca5b922e4a76ba6..5594e0e21c424f33b98ccb29031120aaaed75197 100644 (file)
@@ -8,7 +8,8 @@ read.nexus(file, tree.names = NULL)
   \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.
@@ -18,8 +19,7 @@ read.nexus(file, tree.names = NULL)
   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
@@ -39,27 +39,7 @@ read.nexus(file, tree.names = NULL)
   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
index be62ae07e9dc509a52edfb18eaba58bd5e6986fa..d90ce66e21b67220526f8b262e9094280c7bce8e 100644 (file)
@@ -17,9 +17,9 @@ data(woodmouse)
 }
 \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}}
index 40998f96e6e451ab4c04a57f5f6b2cdc92a4288c..c9a07de0dbd3e498984f9078cd8648edcc4ca5fe 100644 (file)
@@ -10,7 +10,7 @@ yule(phy, use.root.edge = FALSE)
     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.
 }