]> git.donarmstrong.com Git - ape.git/commitdiff
fixing drop.tip and bionj
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Thu, 19 May 2011 16:42:58 +0000 (16:42 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Thu, 19 May 2011 16:42:58 +0000 (16:42 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@158 6e262413-ae40-0410-9e79-b911bd7a66b7

DESCRIPTION
NEWS
R/SlowinskiGuyer.R
R/drop.tip.R
R/me.R
R/root.R
man/delta.plot.Rd
man/diversity.contrast.test.Rd

index 90bd55b06ef6d17c998ecedd96c1383004fb0254..4005e70454ed2f926c0ed4064b616f81966c89c2 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
 Version: 2.7-2
-Date: 2011-03-29
+Date: 2011-05-19
 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, Klaus Schliep, Korbinian Strimmer, Damien de Vienne
 Maintainer: Emmanuel Paradis <Emmanuel.Paradis@ird.fr>
diff --git a/NEWS b/NEWS
index c702b68074489aa961044ce2efd6819da03b96c4..f9af94942c616c89d85011a2975df7e8bb322552 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,17 @@ NEW FEATURES
       is not plotted but the graphical device is set and the
       coordinates are saved as normal.
 
+    o diversity.contrast.test() gains a fourth version of the test with
+      method = "logratio"; the literature citations have been clarified.
+
+
+BUG FIXES
+
+    o bionj() made R crash if distances were two large. It now returns
+      an error if at least one distance is greater than 100.
+
+    o drop.tip() returned a wrong tree if 'tip' was of zero length.
+
 
 
                CHANGES IN APE VERSION 2.7-1
index 1563f02626fef999b9dcbb62d653e71d6e48faa8..b0fc956a54163e20ab2f3c62d0b1708f98852d89 100644 (file)
@@ -1,4 +1,4 @@
-## SlowinskiGuyer.R (2011-03-10)
+## SlowinskiGuyer.R (2011-05-05)
 
 ##   Tests of Diversification Shifts with Sister-Clades
 
@@ -65,7 +65,8 @@ richness.yule.test <- function(x, t)
 diversity.contrast.test <-
     function(x, method = "ratiolog", alternative = "two.sided", nrep = 0, ...)
 {
-    method <- match.arg(method, c("ratiolog", "proportion", "difference"))
+    method <- match.arg(method, c("ratiolog", "proportion",
+                                  "difference", "logratio"))
     alternative <- match.arg(alternative, c("two.sided", "less", "greater"))
 
     minmax <- t(apply(x, 1, sort)) # sort all rows
@@ -81,7 +82,8 @@ diversity.contrast.test <-
                            log(minmax[, 2]) / log(minmax[, 1])
                        },
                        "proportion" = minmax[, 2] / (minmax[, 2] + minmax[, 1]),
-                       "difference" = abs(DIFF))
+                       "difference" = abs(DIFF),
+                       "logratio" = log(minmax[, 1] / minmax[, 2]))
 
     y <- SIGN * CONTRAST # the signed contrasts
 
index 948b2267b8e98a5bd5547b58fa4050f09b69d147..b339578abf490ab764704257d05cff6ee92a842f 100644 (file)
@@ -1,8 +1,8 @@
-## drop.tip.R (2010-11-24)
+## drop.tip.R (2011-05-19)
 
 ##   Remove Tips in a Phylogenetic Tree
 
-## Copyright 2003-2010 Emmanuel Paradis
+## Copyright 2003-2011 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -79,6 +79,7 @@ drop.tip <-
 {
     if (!inherits(phy, "phylo"))
         stop('object "phy" is not of class "phylo"')
+    if (!length(tip)) return(phy)
 
     Ntip <- length(phy$tip.label)
     ## find the tips to drop:
diff --git a/R/me.R b/R/me.R
index 7dca6c020cec10ad3425358756fee5bb480212f0..96c7e652e5cd22e2cdcb24561fdec11a6c12080e 100644 (file)
--- a/R/me.R
+++ b/R/me.R
@@ -1,9 +1,9 @@
-## me.R (2009-01-07)
+## me.R (2011-05-12)
 
 ##   Tree Estimation Based on Minimum Evolution Algorithm
 
 ## Copyright 2007 Vincent Lefort with modifications by
-##                 Emmanuel Paradis (2008-2009)
+##                 Emmanuel Paradis (2008-2011)
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -49,6 +49,8 @@ fastme.ols <- function(X, nni = TRUE)
 bionj <- function(X)
 {
     if (is.matrix(X)) X <- as.dist(X)
+    if (any(X > 100))
+        stop("at least one distance was greater than 100")
     N <- as.integer(attr(X, "Size"))
     labels <- sprintf("%6s", 1:N)
     edge1 <- edge2 <- integer(2*N - 3)
index ac5ec27b5b45d27470b8ca322adc787e86dc6193..5691bb518f01e9b1105b7b886c5ca48952b02e61 100644 (file)
--- a/R/root.R
+++ b/R/root.R
@@ -1,8 +1,8 @@
-## root.R (2010-02-11)
+## root.R (2011-04-29)
 
 ##   Root of Phylogenetic Trees
 
-## Copyright 2004-2010 Emmanuel Paradis
+## Copyright 2004-2011 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -252,7 +252,7 @@ root <- function(phy, outgroup, node = NULL,
     o[NEXT:(NEXT + ne - 1L)] <- s
 
     if (fuseRoot) {
-        phy$Nnode <- oldNnode - 1
+        phy$Nnode <- oldNnode - 1L
         N <- N - 1L
     }
     phy$edge[INV, ] <- phy$edge[INV, 2:1]
@@ -288,7 +288,7 @@ root <- function(phy, outgroup, node = NULL,
             }
         }
         ## N <- N + 1L ... not needed
-        phy$Nnode <- phy$Nnode + 1
+        phy$Nnode <- phy$Nnode + 1L
     }
 
     ## The block below renumbers the nodes so that they conform
index 59877a0b0e4ca745f177ffdb5838f3e92e011d01..cf45e2cfa40cfeb8085f64284f9a08d9d53b8a59 100644 (file)
@@ -7,7 +7,7 @@ delta.plot(X, k = 20, plot = TRUE, which = 1:2)
 \arguments{
   \item{X}{a distance matrix, may be an object of class ``dist''.}
   \item{k}{an integer giving the number of intervals in the plot.}
-  \item{plot}{a logival specifying whether to draw the
+  \item{plot}{a logical specifying whether to draw the
     \eqn{\delta}{delta} plot (the default).}
   \item{which}{a numeric vector indicating which plots are done; 1: the
     histogram of the \eqn{\delta_q}{delta_q} values, 2: the plot of the
index b24d42be4e1c486fa8931c39f090e3606c29ecfa..dd6e7ca7ec53d01146cfa7b92f245cf96e25e765 100644 (file)
@@ -12,26 +12,29 @@ diversity.contrast.test(x, method = "ratiolog",
 \arguments{
   \item{x}{a matrix or a data frame with at least two columns: the first
     one gives the number of species in clades with a trait supposed to
-    increase or decrease diversification rate, and the second one the number of
-    species in the sister-clades without the trait. Each
-    row represents a pair of sister-clades.}
-  \item{method}{a character string specifying the kind of test: \code{"ratiolog"} (default),
-    \code{"proportion"}, \code{"difference"}, or any unambiguous
+    increase or decrease diversification rate, and the second one the
+    number of species in the sister-clades without the trait. Each row
+    represents a pair of sister-clades.}
+  \item{method}{a character string specifying the kind of test:
+    \code{"ratiolog"} (default), \code{"proportion"},
+    \code{"difference"}, \code{"logratio"}, or any unambiguous
     abbreviation of these.}
   \item{alternative}{a character string defining the alternative
     hypothesis:  \code{"two.sided"} (default),  \code{"less"},
     \code{"greater"}, or any unambiguous abbreviation of these.}
   \item{nrep}{the number of replications of the randomization test; by
     default, a Wilcoxon test is done.}
-  \item{\dots}{arguments passed to the function \code{\link[stats]{wilcox.test}}.}
+  \item{\dots}{arguments passed to the function
+    \code{\link[stats]{wilcox.test}}.}
 }
 \details{
   If \code{method = "ratiolog"}, the test described in Barraclough et
   al. (1996) is performed. If \code{method = "proportion"}, the version
   in Barraclough et al. (1995) is used. If \code{method = "difference"},
-  then this is Wiegmann et al.'s (1993) version. Vamosi and Vamosi (2005)
-  gave a detailed account of these three tests which are essentially
-  different versions of the same test.
+  the signed difference is used (Sargent 2004). If \code{method =
+    "logratio"}, then this is Wiegmann et al.'s (1993) version. These
+  four tests are essentially different versions of the same test (Vamosi
+  and Vamosi 2005, Vamosi 2007).
 
   If \code{nrep = 0}, a Wilcoxon test is done on the species diversity
   contrasts with the null hypothesis is that they are distributed around
@@ -52,7 +55,15 @@ diversity.contrast.test(x, method = "ratiolog",
   Barraclough, T. G., Harvey, P. H., and Nee,  S. (1996) Rate of
   \emph{rbc}L gene sequence evolution and species diversification in
   flowering plants (angiosperms). \emph{Proceedings of the Royal Society
-  of London. Series B. Biological Sciences}, \bold{263}, 589--591.
+    of London. Series B. Biological Sciences}, \bold{263}, 589--591.
+
+  Sargent, R. D. (2004) Floral symmetry affects speciation rates in
+  angiosperms. \emph{Proceedings of the Royal Society of London. Series
+  B. Biological Sciences}, \bold{271}, 603--608.
+
+  Vamosi, S. M. (2007) Endless tests: guidelines for analysing non-nested
+  sister-group comparisons. An addendum. \emph{Evolutionary Ecology
+  Research}, \bold{9}, 717.
 
   Vamosi, S. M. and Vamosi, J. C. (2005) Endless tests: guidelines for
   analysing non-nested sister-group comparisons. \emph{Evolutionary