]> git.donarmstrong.com Git - ape.git/commitdiff
fix a bug in as.hclust.phylo + a few typos in man pages
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 30 Nov 2010 08:07:19 +0000 (08:07 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 30 Nov 2010 08:07:19 +0000 (08:07 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@140 6e262413-ae40-0410-9e79-b911bd7a66b7

ChangeLog
DESCRIPTION
R/as.phylo.R
man/parafit.Rd
man/rtree.Rd

index a021f9c327e1f7a003ec05fd9e0e359384e46a52..3cfdf9c7eefa368bfb915d3e1beefaa83a30867c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,9 @@ BUG FIXES
     o drop.tip() shuffled tip labels with subtree = TRUE or trim.internal
       = FALSE.
 
+    o Objects returned by as.hclust.phylo() failed when analysed with
+      cutree() or rect.hclust().
+
 
 
                CHANGES IN APE VERSION 2.6-1
index 04f43c6f9025b841284a0872fef2eca0bc7f326d..ab0adee12f90eccdbbd19bc64f54b3cc82090943 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
 Version: 2.6-2
-Date: 2010-11-24
+Date: 2010-11-30
 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 b576a54e0b719992d2cf653ace068e15926566dc..c0304b50493512e69fcf5032265f7222dc185845 100644 (file)
@@ -1,4 +1,4 @@
-## as.phylo.R (2010-09-30)
+## as.phylo.R (2010-11-30)
 
 ##     Conversion Among Tree Objects
 
@@ -89,20 +89,22 @@ as.hclust.phylo <- function(x, ...)
     if (!is.ultrametric(x)) stop("the tree is not ultrametric")
     if (!is.binary.tree(x)) stop("the tree is not binary")
     n <- length(x$tip.label)
-    bt <- rev(branching.times(x))
-    N <- length(bt)
-    nm <- x$Nnode:1 + n # fix by Filipe G. Vieira (2010-09-30)
+    bt <- sort(branching.times(x))
+    inode <- as.numeric(names(bt))
+    N <- n - 1L
+    nm <- numeric(N + n) # hash table
+    nm[inode] <- 1:N
     merge <- matrix(NA, N, 2)
     for (i in 1:N) {
-        ind <- which(x$edge[, 1] == nm[i])
-        for (k in 1:2)
-          merge[i, k] <- if (x$edge[ind[k], 2] <= n) -x$edge[ind[k], 2]
-          else which(nm == x$edge[ind[k], 2])
+        ind <- which(x$edge[, 1] == inode[i])
+        for (k in 1:2) {
+            tmp <- x$edge[ind[k], 2]
+            merge[i, k] <- if (tmp <= n) -tmp else nm[tmp]
+        }
     }
     names(bt) <- NULL
-    obj <- list(merge = merge, height = bt, order = 1:(N + 1),
-                labels = x$tip.label, call = match.call(),
-                method = "unknown")
+    obj <- list(merge = merge, height = bt, order = 1:n, labels = x$tip.label,
+                call = match.call(), method = "unknown")
     class(obj) <- "hclust"
     obj
 }
index 6cb16ac835b61fccf3df3fb46b72f1a9d02d4c1a..b819656c6971e134baf1eaee17f94b5d490657fe 100644 (file)
@@ -11,8 +11,8 @@ Function \code{\link{parafit}} tests the hypothesis of coevolution between a cla
 The method, which is described in detail in Legendre et al. (2002), requires some estimates of the phylogenetic trees or phylogenetic distances, and also a description of the host-parasite associations (H-P links) observed in nature.
 }
 \usage{
-parafit(host.D, para.D ,HP ,nperm=999, test.links=FALSE, seed=NULL,
-correction="none", silent=FALSE)
+parafit(host.D, para.D, HP, nperm = 999, test.links = FALSE,
+        seed = NULL, correction = "none", silent = FALSE)
 }
 
 \arguments{
index 05a1fbea45e92ddd4bf67263fd44fa828de8dd14..0f2dbaaac474f1754aa1e6b7bf6d4018590481df 100644 (file)
@@ -46,7 +46,7 @@ rmtree(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...)
 }
 \author{Emmanuel Paradis}
 \seealso{
-  \code{\link{stree}}
+  \code{\link{stree}}, \code{\link{rlineage}}
 }
 \examples{
 layout(matrix(1:9, 3, 3))