]> git.donarmstrong.com Git - ape.git/commitdiff
some bug fixes and '...' in rTrait*()
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Fri, 24 Dec 2010 17:32:05 +0000 (17:32 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Fri, 24 Dec 2010 17:32:05 +0000 (17:32 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@143 6e262413-ae40-0410-9e79-b911bd7a66b7

ChangeLog
DESCRIPTION
R/as.phylo.R
R/rTrait.R
Thanks
man/rTraitCont.Rd
man/rTraitDisc.Rd

index 53f4a6209d15230d3dbb36932f60b65c3c173daa..dd37289ac4ec445157506520a0b9f9011057931b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,19 @@
                CHANGES IN APE VERSION 2.6-3
 
 
+NEW FEATURES
+
+    o rTraitCont() and rTraitDisc() gains a '...' argument used with
+      user-defined models (suggestion by Gene Hunt).
+
+
 BUG FIXES
 
     o as.hclust.phylo() now returns an error with unrooted trees.
 
+    o as.hclust.phylo() failed with trees with node labels (thanks to
+      Jinlong Zhang for pointing this bug out).
+
 
 
                CHANGES IN APE VERSION 2.6-2
index a9d4511a172f00fca41b823449e23028692900aa..f5a28e08e7fee1242ddcb27aa5ece21afa707e10 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
 Version: 2.6-3
-Date: 2010-12-14
+Date: 2010-12-24
 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>
index f5a2569f7577f0236a7d7456d0ac2ab15e21f61e..e8d0f667a325b8df396f2f552d38ecbfa78e1f74 100644 (file)
@@ -1,4 +1,4 @@
-## as.phylo.R (2010-12-14)
+## as.phylo.R (2010-12-15)
 
 ##     Conversion Among Tree Objects
 
@@ -90,6 +90,7 @@ as.hclust.phylo <- function(x, ...)
     if (!is.binary.tree(x)) stop("the tree is not binary")
     if (!is.rooted(x)) stop("the tree is not rooted")
     n <- length(x$tip.label)
+    x$node.label <- NULL # by Jinlong Zhang (2010-12-15)
     bt <- sort(branching.times(x))
     inode <- as.numeric(names(bt))
     N <- n - 1L
index 2c04dc6dd0855e246de03107d4b70017386baab3..b87dd6f8a60ff023271acfb1339c36fdc53d190e 100644 (file)
@@ -1,4 +1,4 @@
-## rTrait.R (2010-07-26)
+## rTrait.R (2010-12-24)
 
 ##   Trait Evolution
 
@@ -10,7 +10,7 @@
 rTraitDisc <-
     function(phy, model = "ER", k = if (is.matrix(model)) ncol(model) else 2,
              rate = 0.1, states = LETTERS[1:k], freq = rep(1/k, k),
-             ancestor = FALSE, root.value = 1)
+             ancestor = FALSE, root.value = 1, ...)
 {
     if (is.null(phy$edge.length))
         stop("tree has no branch length")
@@ -56,7 +56,7 @@ rTraitDisc <-
 
     if (is.function(model)) {
         environment(model) <- environment() # to find 'k'
-        for (i in N:1) x[des[i]] <- model(x[anc[i]], el[i])
+        for (i in N:1) x[des[i]] <- model(x[anc[i]], el[i], ...)
     } else {
         freq <- rep(freq, each = k)
         Q <- Q * freq
@@ -82,7 +82,7 @@ rTraitDisc <-
 
 rTraitCont <-
     function(phy, model = "BM", sigma = 0.1, alpha = 1, theta = 0,
-             ancestor = FALSE, root.value = 0, linear = TRUE)
+             ancestor = FALSE, root.value = 0, linear = TRUE, ...)
 {
     if (is.null(phy$edge.length))
         stop("tree has no branch length")
@@ -102,7 +102,7 @@ rTraitCont <-
 
     if (is.function(model)) {
         environment(model) <- environment()
-        for (i in N:1) x[des[i]] <- model(x[anc[i]], el[i])
+        for (i in N:1) x[des[i]] <- model(x[anc[i]], el[i], ...)
     } else {
         model <- pmatch(toupper(model), c("BM", "OU"))
         if (length(sigma) == 1) sigma <- rep(sigma, N)
diff --git a/Thanks b/Thanks
index 402c81a87bf2d1c55d455695055c5b29ab1478c8..b979f72f70942b62a3935ec15f8d751337e44d4d 100644 (file)
--- a/Thanks
+++ b/Thanks
@@ -8,8 +8,8 @@ Significant bug fixes were provided by C
 James Bullard, Otto Cordero, Éric Durand, Olivier François, Rich
 FitzJohn, , Jos Käfer, Bret Larget, Naim Matasci, Nick Matzke, Michael
 Phelan, Elizabeth Purdom, Dan Rabosky, Filipe Vieira, Tim Wallstrom,
-Li-San Wang, Yan Wong, Peter Wragg, and Janet Young. Contact me if I
-forgot someone.
+Li-San Wang, Yan Wong, Peter Wragg, Janet Young, and Jinlong Zhang.
+Contact me if I forgot someone.
 
 Kurt Hornik, of the R Core Team, helped in several occasions to
 fix some problems and bugs.
index 6ff347846cad82bbb8a98139980b18864bb18dc2..908bf009601262483a8f23722c1cfb3a192035c5 100644 (file)
@@ -3,7 +3,7 @@
 \title{Continuous Character Simulation}
 \usage{
 rTraitCont(phy, model = "BM", sigma = 0.1, alpha = 1, theta = 0,
-           ancestor = FALSE, root.value = 0, linear = TRUE)
+           ancestor = FALSE, root.value = 0, linear = TRUE, ...)
 }
 \arguments{
   \item{phy}{an object of class \code{"phylo"}.}
@@ -22,6 +22,8 @@ rTraitCont(phy, model = "BM", sigma = 0.1, alpha = 1, theta = 0,
   \item{root.value}{a numeric giving the value at the root.}
   \item{linear}{a logical indicating which parameterisation of the OU
     model to use (see details).}
+  \item{\dots}{further arguments passed to \code{model} if it is a
+    function.}
 }
 \description{
   This function simulates the evolution of a continuous character along a
index ed1919d710de03821f7989b852c0f1bca6e72408..e65a54b29604ada34b0492d229b6ff63d23d159b 100644 (file)
@@ -24,6 +24,8 @@ rTraitDisc(phy, model = "ER", k = if (is.matrix(model)) ncol(model) else 2,
   \item{root.value}{an integer giving the value at the root (by default,
     it's the first state). To have a random value, use \code{root.value
       = sample(k)}.}
+  \item{\dots}{further arguments passed to \code{model} if it is a
+    function.}
 }
 \description{
   This function simulates the evolution of a discrete character along a