]> git.donarmstrong.com Git - ape.git/commitdiff
fixes in bind.tree()
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Wed, 2 Mar 2011 06:47:44 +0000 (06:47 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Wed, 2 Mar 2011 06:47:44 +0000 (06:47 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@148 6e262413-ae40-0410-9e79-b911bd7a66b7

ChangeLog
DESCRIPTION
R/bind.tree.R
R/pic.R

index c88556f37ac0c9cc7505097d2dba56924c785247..e163a853030d34ef265e8863e8184e1ce10bb186 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,7 +15,12 @@ BUG FIXES
     o prop.part() failed in some situations with unrooted trees.
 
     o read.nexus() shuffled node labels when a TRANSLATE block was
-      present
+      present.
+
+    o varCompPhylip() did not work if 'exec' was specified.
+
+    o bind.tree() shuffled node labels when position > 0 and 'where'
+      was not the root.
 
 
 OTHER CHANGES
index 7a2aa94cce504cc34fff198cd0734ef3e31e394c..e364002cc716f418f546f6aa51c654a740ad7673 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
 Version: 2.6-4
-Date: 2011-02-28
+Date: 2011-03-02
 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 b862b37db3d32a7f8848d07d54dbb48097042951..58d7caba4a4a9831652ea6a159d976cb8b07c87f 100644 (file)
@@ -1,8 +1,8 @@
-## bind.tree.R (2010-05-25)
+## bind.tree.R (2011-03-02)
 
 ##    Bind Trees
 
-## 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.
@@ -77,7 +77,7 @@ bind.tree <- function(x, y, where = "root", position = 0, interactive = FALSE)
         }
     }
 
-    ## the special of substituting two tips:
+    ## the special case of substituting two tips:
     if (case == 2 && ny == 1 && !position) {
         x$tip.label[x$edge[i, 2]] <- y$tip.label
         if (wbl)
@@ -88,14 +88,14 @@ bind.tree <- function(x, y, where = "root", position = 0, interactive = FALSE)
     x <- reorder(x)
     y <- reorder(y)
 
-### because in all situations internal nodes need to be renumbered,
-### they are changed to negatives first, and nodes that eventually
-### will be added will be numbered sequentially
+### because in all situations internal nodes need to be
+### renumbered, they are changed to negatives first, and
+### nodes eventually added will be numbered sequentially
 
     nodes <- x$edge > nx
     x$edge[nodes] <- -(x$edge[nodes] - nx) # -1, ..., -mx
     nodes <- y$edge > ny
-    y$edge[nodes] <- -(y$edge[nodes] - ny + mx) #  -(mx+1), ..., -(mx+my)
+    y$edge[nodes] <- -(y$edge[nodes] - ny + mx) # -(mx+1), ..., -(mx+my)
     ROOT <- -1L # may change later
     next.node <- -(mx + my) - 1L
 
@@ -198,19 +198,18 @@ bind.tree <- function(x, y, where = "root", position = 0, interactive = FALSE)
     ## update the node labels before renumbering (this adds NA for
     ## the added nodes, and drops the label for those deleted)
     if (!is.null(x$node.label))
-        x$node.label <- x$node.label[-unique(x$edge[, 1])]
+        x$node.label <- x$node.label[sort(-unique(x$edge[, 1]))]
 
     ## renumber nodes:
     newNb <- integer(x$Nnode)
     newNb[-ROOT] <- n + 1L
     sndcol <- x$edge[, 2] < 0
     ## executed from right to left, so newNb is modified before x$edge:
-    x$edge[sndcol, 2] <- newNb[-x$edge[sndcol, 2]] <-
-        (n + 2):(n + x$Nnode)
+    x$edge[sndcol, 2] <- newNb[-x$edge[sndcol, 2]] <- n + 2:x$Nnode
     x$edge[, 1] <- newNb[-x$edge[, 1]]
 
     if (!is.null(x$node.label))
-        x$node.label <- x$node.label[newNb[newNb == 0] - n]
+        x$node.label <- x$node.label[order(newNb[newNb > 0])]
 
     x
 }
diff --git a/R/pic.R b/R/pic.R
index 122b60d3c7fd679acd091b6a694303d965ce0bc2..816a09b0a6b29b4de083c6f681ea2fe90e0b3b77 100644 (file)
--- a/R/pic.R
+++ b/R/pic.R
@@ -1,8 +1,8 @@
-## pic.R (2010-11-15)
+## pic.R (2011-03-01)
 
 ##   Phylogenetically Independent Contrasts
 
-## Copyright 2002-2010 Emmanuel Paradis
+## Copyright 2002-2011 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -174,7 +174,7 @@ varCompPhylip <- function(x, phy, exec = NULL)
     odir <- setwd(pfx)
     on.exit(setwd(odir))
     if (file.exists("outfile")) unlink("outfile")
-    system("phylip contrast", intern = TRUE, input = c("W", "A", "Y"))
+    system(exec, intern = TRUE, input = c("W", "A", "Y"))
     varA <- scan("outfile", skip = 7, nlines = p, quiet = TRUE)
     varE <- scan("outfile", skip = 11 + p, nlines = p, quiet = TRUE)
     if (p > 1) {