From 0e8dcca3046844b0b36b4f5855e6c10319db45a2 Mon Sep 17 00:00:00 2001 From: paradis Date: Wed, 4 Mar 2009 08:38:20 +0000 Subject: [PATCH] correcting bug in drop.tip git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@64 6e262413-ae40-0410-9e79-b911bd7a66b7 --- ChangeLog | 5 +++++ DESCRIPTION | 2 +- R/drop.tip.R | 9 +++++---- man/plot.phylo.Rd | 10 ---------- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d14a5b..c01a581 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,11 @@ NEW FEATURES Yule model by maximum likelihood. +BUG FIXES + + o drop.tip() shuffled tip labels in some cases. + + CHANGES IN APE VERSION 2.2-4 diff --git a/DESCRIPTION b/DESCRIPTION index e013e3f..65f9a43 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.3 -Date: 2009-02-20 +Date: 2009-03-04 Title: Analyses of Phylogenetics and Evolution Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, diff --git a/R/drop.tip.R b/R/drop.tip.R index d819c75..69c9576 100644 --- a/R/drop.tip.R +++ b/R/drop.tip.R @@ -1,4 +1,4 @@ -## drop.tip.R (2009-01-07) +## drop.tip.R (2009-03-04) ## Remove Tips in a Phylogenetic Tree @@ -22,7 +22,8 @@ extract.clade <- function(phy, node, root.edge = 0) stop("the tree has no node labels") node <- which(phy$node.label %in% node) + Ntip } - if (node <= Ntip) stop("node number must be greater than the number of tips") + if (node <= Ntip) + stop("node number must be greater than the number of tips") if (node == ROOT) return(phy) phy <- reorder(phy) # insure it is in cladewise order root.node <- which(phy$edge[, 2] == node) @@ -143,7 +144,7 @@ drop.tip <- ## 2) renumber the remaining tips now TIPS <- phy$edge[, 2] <= Ntip ## keep the ordering so no need to reorder tip.label: - phy$edge[TIPS, 2] <- order(phy$edge[TIPS, 2]) + phy$edge[TIPS, 2] <- rank(phy$edge[TIPS, 2]) Ntip <- length(phy$tip.label) # update Ntip ## make new tip labels if necessary @@ -176,6 +177,6 @@ drop.tip <- phy$edge[sndcol, 2] <- newNb[phy$edge[sndcol, 2]] <- (Ntip + 2):(Ntip + phy$Nnode) phy$edge[, 1] <- newNb[phy$edge[, 1]] - + storage.mode(phy$edge) <- "integer" collapse.singles(phy) } diff --git a/man/plot.phylo.Rd b/man/plot.phylo.Rd index b9622ef..dcabb28 100644 --- a/man/plot.phylo.Rd +++ b/man/plot.phylo.Rd @@ -184,16 +184,6 @@ plot(tree.owls, type = "c", use.edge.length = FALSE) plot(tree.owls, type = "u", use.edge.length = FALSE) layout(matrix(1)) -data(xenarthra) -plot(xenarthra) -### remove the margins... -plot(xenarthra, no.margin = TRUE) -### ... and use a smaller font size -plot(xenarthra, no.margin = TRUE, cex = 0.8) -plot(xenarthra, type = "c", no.margin = TRUE, - use.edge.length = FALSE, cex = 0.8) -par(mar = c(5.1, 4.1, 4.1, 2.1)) - data(bird.orders) ### using random colours and thickness plot(bird.orders, -- 2.39.5