From: paradis Date: Wed, 28 Oct 2009 03:21:37 +0000 (+0000) Subject: some bug fixes X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=sidebyside;h=bd53d983d5daf867bc50b00ace48d017506599ef;p=ape.git some bug fixes git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@96 6e262413-ae40-0410-9e79-b911bd7a66b7 --- diff --git a/ChangeLog b/ChangeLog index 8cebd96..296d657 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ + CHANGES IN APE VERSION 2.4-1 + + +BUG FIXES + + o bind.tree() failed when 'y' had no root edge. + + o read.nexus() shuffled tip labels when the trees have no branch + lengths and there is a TRANSLATE block. + + o plot.multiPhylo() crashed R when plotting a list of trees with + "compressed tip labels". + + o write.nexus() did not translate the taxa names when asked for. + + + CHANGES IN APE VERSION 2.4 @@ -206,7 +223,7 @@ BUG FIXES OTHER CHANGES - o There is now a general help page displayed with '?ape' + o There is now a general help page displayed with '?ape'. diff --git a/DESCRIPTION b/DESCRIPTION index f6ed121..be5a57a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape -Version: 2.4 -Date: 2009-10-03 +Version: 2.4-1 +Date: 2009-10-27 Title: Analyses of Phylogenetics and Evolution Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, Gangolf Jobb, Christoph Heibl, Daniel Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, Yvonnick Noel, Johan Nylander, Rainer Opgen-Rhein, Korbinian Strimmer, Damien de Vienne Maintainer: Emmanuel Paradis diff --git a/R/bind.tree.R b/R/bind.tree.R index 18dfce4..9df19b5 100644 --- a/R/bind.tree.R +++ b/R/bind.tree.R @@ -1,8 +1,8 @@ -## bind.tree.R (2007-12-21) +## bind.tree.R (2009-10-08) ## Bind Trees -## Copyright 2003-2007 Emmanuel Paradis +## Copyright 2003-2009 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -64,10 +64,11 @@ bind.tree <- function(x, y, where = "root", position = 0) stop("argument 'position' is larger than the specified edge.") x$edge.length[i] <- x$edge.length[i] - position } - if (yHasNoRootEdge ) y$root.edge <- position - else y$root.edge <- y$root.edge + position + y$root.edge <- if (yHasNoRootEdge) position else y$root.edge + position } + if (is.null(y$root.edge) && where > nb.tip) y$root.edge <- 0 + X <- write.tree(x) Y <- write.tree(y) Y <- substr(Y, 1, nchar(Y) - 1) diff --git a/R/plot.phylo.R b/R/plot.phylo.R index eb3ad5c..7798d28 100644 --- a/R/plot.phylo.R +++ b/R/plot.phylo.R @@ -1,4 +1,4 @@ -## plot.phylo.R (2009-09-30) +## plot.phylo.R (2009-10-27) ## Plot Phylogenies @@ -590,5 +590,5 @@ plot.multiPhylo <- function(x, layout = 1, ...) par(ask = TRUE) on.exit(par(ask = FALSE)) } - for (i in x) plot(i, ...) + for (i in 1:length(x)) plot(x[[i]], ...) } diff --git a/R/read.nexus.R b/R/read.nexus.R index 3edcd3f..8c9abc2 100644 --- a/R/read.nexus.R +++ b/R/read.nexus.R @@ -1,4 +1,4 @@ -## read.nexus.R (2009-04-01) +## read.nexus.R (2009-10-27) ## Read Tree File in Nexus Format @@ -224,7 +224,16 @@ read.nexus <- function(file, tree.names = NULL) } } else { if (!is.null(tree.names)) names(trees) <- tree.names - if (translation) attr(trees, "TipLabel") <- TRANS[, 2] + if (translation) { + if (length(colon) == Ntree) # .treeBuildWithTokens() was used + attr(trees, "TipLabel") <- TRANS[, 2] + else { # reassign the tip labels then compress + for (i in 1:Ntree) + trees[[i]]$tip.label <- + TRANS[, 2][as.numeric(trees[[i]]$tip.label)] + trees <- .compressTipLabel(trees) + } + } class(trees) <- "multiPhylo" } if (length(grep("[\\/]", file)) == 1) diff --git a/R/write.nexus.R b/R/write.nexus.R index 1a816f0..14f7734 100644 --- a/R/write.nexus.R +++ b/R/write.nexus.R @@ -1,4 +1,4 @@ -## write.nexus.R (2009-07-27) +## write.nexus.R (2009-10-27) ## Write Tree File in Nexus Format @@ -69,9 +69,11 @@ the original data won't be written with the tree.")) token <- as.character(1:N) names(token) <- obj[[1]]$tip.label obj[[1]]$tip.label <- token - if (ntree > 1) - for (i in 2:ntree) - obj[[i]]$tip.label <- token[obj[[i]]$tip.label] + if (ntree > 1) { + for (i in 2:ntree) + obj[[i]]$tip.label <- token[obj[[i]]$tip.label] + class(obj) <- NULL + } } else { for (i in 1:ntree) obj[[i]]$tip.label <- checkLabel(obj[[i]]$tip.label)