From bfd7604547c1dd38cd97707c184bebf3525cf426 Mon Sep 17 00:00:00 2001 From: paradis Date: Sat, 24 Mar 2012 14:17:54 +0000 Subject: [PATCH] various bug fixes git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@182 6e262413-ae40-0410-9e79-b911bd7a66b7 --- DESCRIPTION | 2 +- NEWS | 9 +++++++++ R/dbd.R | 4 ++-- R/dist.topo.R | 11 ++++++++--- R/is.monophyletic.R | 15 +++++++-------- R/mantel.test.R | 4 ++-- R/plot.phylo.R | 10 +++++----- man/yule.time.Rd | 2 +- 8 files changed, 35 insertions(+), 22 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a69b65a..903c8b1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 3.0-2 -Date: 2012-03-05 +Date: 2012-03-22 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 diff --git a/NEWS b/NEWS index 87f4ffa..de2da10 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,15 @@ BUG FIXES o mltt.plot(, backward = FALSE) did not set the x-axis correctly. + o A bug was introduced in prop.clades() with ape 3.0. + + o mantel.test() printed a useless warning message. + + o plot.phylo(, direction = "downward") ignored 'y.lim'. + + o is.monophyletic() did not work correctly if 'tips' was not stored + as integers + CHANGES IN APE VERSION 3.0-1 diff --git a/R/dbd.R b/R/dbd.R index b6df418..3a325dc 100644 --- a/R/dbd.R +++ b/R/dbd.R @@ -1,4 +1,4 @@ -## dbd.R (2012-02-01) +## dbd.R (2012-03-19) ## Probability Density Under Birth--Death Models @@ -32,7 +32,7 @@ dbd <- function(x, lambda, mu, t, conditional = FALSE, log = FALSE) warning("only the first value of 't' was considered") } - if (mu == 0) return(ryule(x, lambda, t, log)) + if (mu == 0) return(dyule(x, lambda, t, log)) ## for the unconditional case, we have to consider x=0 separately: if (!conditional) { diff --git a/R/dist.topo.R b/R/dist.topo.R index d4791c3..5777482 100644 --- a/R/dist.topo.R +++ b/R/dist.topo.R @@ -1,4 +1,4 @@ -## dist.topo.R (2012-02-03) +## dist.topo.R (2012-03-13) ## Topological Distances, Tree Bipartitions, ## Consensus Trees, and Bootstrapping Phylogenies @@ -170,7 +170,11 @@ prop.clades <- function(phy, ..., part = NULL, rooted = FALSE) } bp <- prop.part(phy) - if (!rooted) bp <- postprocess.prop.part(bp) + if (!rooted) { + bp <- postprocess.prop.part(bp) + part <- postprocess.prop.part(part) # fix by Klaus Schliep + ## actually the above line in not needed if called from boot.phylo() + } n <- numeric(phy$Nnode) for (i in seq_along(bp)) { @@ -202,7 +206,8 @@ boot.phylo <- function(phy, x, FUN, B = 100, block = 1, } } boot.tree <- vector("list", B) - if (!quiet) progbar <- utils::txtProgressBar(style = 3) # suggestion by Alastair Potts + if (!quiet) # suggestion by Alastair Potts + progbar <- utils::txtProgressBar(style = 3) for (i in 1:B) { if (block > 1) { y <- seq(block, ncol(x), block) diff --git a/R/is.monophyletic.R b/R/is.monophyletic.R index d25264b..06ee9c1 100644 --- a/R/is.monophyletic.R +++ b/R/is.monophyletic.R @@ -1,8 +1,8 @@ -## ace.R (2009-06-19) +## is.monophyletic.R (2012-03-23) -## Ancestral Character Estimation +## Test Monophyly -## Copyright 2009 Johan Nylander and Emmanuel Paradis +## Copyright 2009-2012 Johan Nylander and Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -12,14 +12,13 @@ is.monophyletic <- { if (!inherits(phy, "phylo")) stop("object 'phy' is not of class 'phylo'") - if (length(tips) == 1) return(TRUE) n <- length(phy$tip.label) - if (length(tips) == n) return(TRUE) - ROOT <- n + 1 + if (length(tips) %in% c(1L, n)) return(TRUE) + ROOT <- n + 1L if (is.numeric(tips)) { if (any(tips > n)) stop("incorrect tip#: should not be greater than the number of tips") - tips <- sort(tips) + tips <- sort(as.integer(tips)) } if (is.character(tips)) tips <- which(phy$tip.label %in% tips) @@ -50,4 +49,4 @@ is.monophyletic <- } ## assuming that both vectors are sorted: identical(tips, desc) -} # end of is.monophyletic +} diff --git a/R/mantel.test.R b/R/mantel.test.R index c5c1da2..0de2ad9 100644 --- a/R/mantel.test.R +++ b/R/mantel.test.R @@ -1,4 +1,4 @@ -## mantel.test.R (2011-11-11) +## mantel.test.R (2012-03-16) ## Mantel Test for Similarity of Two Matrices @@ -18,7 +18,7 @@ mant.zstat <- function(m1, m2) sum(lower.triang(m1 * m2)) lower.triang <- function(m) { - if (!diff(dim(m))) print("Warning: non-square matrix") + if (diff(dim(m))) print("Warning: non-square matrix") m[col(m) <= row(m)] } diff --git a/R/plot.phylo.R b/R/plot.phylo.R index 32e5506..3fd0637 100644 --- a/R/plot.phylo.R +++ b/R/plot.phylo.R @@ -1,8 +1,8 @@ -## plot.phylo.R (2011-12-03) +## plot.phylo.R (2012-03-22) ## Plot Phylogenies -## Copyright 2002-2011 Emmanuel Paradis +## Copyright 2002-2012 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -260,12 +260,12 @@ plot.phylo <- y.lim <- c(0, y.lim) if (phyloORclado && horizontal) y.lim[1] <- 1 if (type %in% c("fan", "unrooted") && show.tip.label) - y.lim[1] <- -max(nchar(x$tip.label) * 0.018 * max(yy) * cex) + y.lim[1] <- -max(nchar(x$tip.label) * 0.018 * max(yy) * cex) if (type == "radial") - y.lim[1] <- if (show.tip.label) -1 - max(nchar(x$tip.label) * 0.018 * max(yy) * cex) else -1 + y.lim[1] <- if (show.tip.label) -1 - max(nchar(x$tip.label) * 0.018 * max(yy) * cex) else -1 } ## mirror the yy: - if (phyloORclado && direction == "downwards") yy <- y.lim[2] - yy + if (phyloORclado && direction == "downwards") yy <- max(yy) - yy if (phyloORclado && root.edge) { if (direction == "leftwards") x.lim[2] <- x.lim[2] + x$root.edge if (direction == "downwards") y.lim[2] <- y.lim[2] + x$root.edge diff --git a/man/yule.time.Rd b/man/yule.time.Rd index 5092c2f..ccc0d5a 100644 --- a/man/yule.time.Rd +++ b/man/yule.time.Rd @@ -50,7 +50,7 @@ yule.time(phy, birth, BIRTH = NULL, root.time = 0, opti = "nlm", start = 0.01) \references{ Hubert, N., Paradis, E., Bruggemann, H. & Planes, S. (2011) Community assembly and diversification in Indo-Pacific coral reef - fishes. \emph{Ecology and Evolution} (in press). + fishes. \emph{Ecology and Evolution}, \bold{1}, 229--277. } \seealso{ \code{\link{branching.times}}, \code{\link{ltt.plot}}, -- 2.39.2