From 4ef7ac2c31da7b7c70a31f1f95a1182d22c3a71a Mon Sep 17 00:00:00 2001 From: paradis Date: Tue, 21 Jun 2011 11:31:21 +0000 Subject: [PATCH] various bug fixes git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@161 6e262413-ae40-0410-9e79-b911bd7a66b7 --- DESCRIPTION | 2 +- NEWS | 16 ++++++++++++++-- R/bind.tree.R | 4 ++-- R/rTrait.R | 11 +++++++---- man/rTraitCont.Rd | 2 +- man/rTraitDisc.Rd | 2 +- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6284419..269ff2d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.7-3 -Date: 2011-06-14 +Date: 2011-06-21 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 diff --git a/NEWS b/NEWS index 0bc5340..a5c311c 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,10 @@ CHANGES IN APE VERSION 2.7-3 -NEW FEATURES +BUG FIXES - o There is a new predict() method for compar.gee(). + o Branch lengths were wrongly updated with bind.tree(, where = , + position = 0). (Thanks to Liam Revell for digging this bug out.) @@ -17,6 +18,9 @@ NEW FEATURES and four conversion methods to the classes "phylo", "networx", "network", and "igraph". + o The new function rTraitMult does multivariate traits simulation + with user-defined models. + o plot.phylo() has a new option 'plot = TRUE'. If FALSE, the tree is not plotted but the graphical device is set and the coordinates are saved as usual. @@ -30,6 +34,8 @@ NEW FEATURES o boot.phylo() now displays a progress bar by default (can be off if 'quiet = TRUE'). + o There is a new predict() method for compar.gee(). + BUG FIXES @@ -44,6 +50,12 @@ BUG FIXES presence of identical or nearly identical sequences. +OTHER CHANGES + + o The data bird.families, bird.orders, cynipids, and woodmouse are + now provided as .rda files. + + CHANGES IN APE VERSION 2.7-1 diff --git a/R/bind.tree.R b/R/bind.tree.R index 58d7cab..cc7ee1f 100644 --- a/R/bind.tree.R +++ b/R/bind.tree.R @@ -1,4 +1,4 @@ -## bind.tree.R (2011-03-02) +## bind.tree.R (2011-06-21) ## Bind Trees @@ -146,8 +146,8 @@ bind.tree <- function(x, y, where = "root", position = 0, interactive = FALSE) y$edge[1] <- x$edge[i, 1] ## delete i-th edge in x: x$edge <- x$edge[-i, ] - i <- i - 1L if (wbl) x$edge.length <- x$edge.length[-i] + i <- i - 1L } x$tip.label <- x$tip.label[-where] ## renumber the tips that need to: diff --git a/R/rTrait.R b/R/rTrait.R index 2c18d09..6731c5c 100644 --- a/R/rTrait.R +++ b/R/rTrait.R @@ -1,4 +1,4 @@ -## rTrait.R (2011-04-02) +## rTrait.R (2011-06-16) ## Trait Evolution @@ -135,7 +135,7 @@ rTraitCont <- rTraitMult <- function(phy, model, p = 1, root.value = rep(0, p), ancestor = FALSE, - as.factor = NULL, ...) + asFactor = NULL, trait.labels = paste("x", 1:p, sep = ""), ...) { phy <- reorder(phy, "pruningwise") n <- length(phy$tip.label) @@ -152,6 +152,8 @@ rTraitMult <- el <- phy$edge.length if (is.null(el)) el <- numeric(N) + environment(model) <- environment() # to find 'p' + for (i in N:1) x[des[i], ] <- model(x[anc[i], ], el[i], ...) if (ancestor) { @@ -162,8 +164,9 @@ rTraitMult <- rownames(x) <- phy$tip.label } x <- as.data.frame(x) - if (!is.null(as.factor)) { - for (i in as.factor) { + names(x) <- trait.labels + if (!is.null(asFactor)) { + for (i in asFactor) { y <- x[, i] x[, i] <- factor(y, labels = LETTERS[1:length(unique(y))]) } diff --git a/man/rTraitCont.Rd b/man/rTraitCont.Rd index 908bf00..8a72487 100644 --- a/man/rTraitCont.Rd +++ b/man/rTraitCont.Rd @@ -78,7 +78,7 @@ rTraitCont(phy, model = "BM", sigma = 0.1, alpha = 1, theta = 0, } \author{Emmanuel Paradis} \seealso{ - \code{\link{rTraitDisc}}, \code{\link{ace}} + \code{\link{rTraitDisc}}, \code{\link{rTraitMult}}, \code{\link{ace}} } \examples{ data(bird.orders) diff --git a/man/rTraitDisc.Rd b/man/rTraitDisc.Rd index b6b619c..e2c43d9 100644 --- a/man/rTraitDisc.Rd +++ b/man/rTraitDisc.Rd @@ -65,7 +65,7 @@ rTraitDisc(phy, model = "ER", k = if (is.matrix(model)) ncol(model) else 2, } \author{Emmanuel Paradis} \seealso{ - \code{\link{rTraitCont}}, \code{\link{ace}} + \code{\link{rTraitCont}}, \code{\link{rTraitMult}}, \code{\link{ace}} } \examples{ data(bird.orders) -- 2.39.2