From 5c40f536fadaa42ad1683969cfe249c4fabba87a Mon Sep 17 00:00:00 2001 From: paradis Date: Thu, 19 Jun 2008 10:24:37 +0000 Subject: [PATCH] bug fix in collapsed.singles() git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@36 6e262413-ae40-0410-9e79-b911bd7a66b7 --- Changes | 7 +++++-- DESCRIPTION | 2 +- R/collapse.singles.R | 15 ++++++++++++++- Thanks | 4 ++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index 3d1da07..df065d4 100644 --- a/Changes +++ b/Changes @@ -9,11 +9,14 @@ NEW FEATURES BUG FIXES - o root() failed with resolve.root = TRUE when the root was already - the specified root. + o root() failed with 'resolve.root = TRUE' when the root was + already the specified root. o Several bugs were fixed in mlphylo(). + o collapsed.singles() did not propagate the 'Nnode' and + 'node.labels' elements (thanks to Elizabeth Purdom for the fix. + OTHER CHANGES diff --git a/DESCRIPTION b/DESCRIPTION index 985cdf0..71e4a76 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.2-1 -Date: 2008-06-18 +Date: 2008-06-19 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/collapse.singles.R b/R/collapse.singles.R index cfbf4c8..ad3cd98 100644 --- a/R/collapse.singles.R +++ b/R/collapse.singles.R @@ -1,4 +1,4 @@ -## collapse.singles.R (2006-07-15) +## collapse.singles.R (2008-06-19) ## Collapse "Single" Nodes @@ -11,6 +11,11 @@ collapse.singles <- function(tree) { elen <- tree$edge.length xmat <- tree$edge + ## added by Elizabeth Purdom (2008-06-19): + node.lab<-tree$node.label + nnode<-tree$Nnode + ntip<-length(tree$tip.label) + ## end singles <- NA while (length(singles) > 0) { ## changed by EP to make it slightly more efficient: @@ -30,10 +35,18 @@ collapse.singles <- function(tree) xmat[xmat > i] <- xmat[xmat > i] - 1 ## adjust indices ## END elen[prev.node] <- elen[prev.node] + elen[next.node] + ## added by Elizabeth Purdom (2008-06-19): + if(!is.null(node.lab)) node.lab<-node.lab[-c(i-ntip)] + nnode<-nnode-1 + ## end elen <- elen[-next.node] } } tree$edge <- xmat tree$edge.length <- elen + ## added by Elizabeth Purdom (2008-06-19): + tree$node.label<-node.lab + tree$Nnode<-nnode + ## end tree } diff --git a/Thanks b/Thanks index 8b19985..0bac636 100644 --- a/Thanks +++ b/Thanks @@ -5,8 +5,8 @@ Many users gave important feed-back with their encouragements, comments, or bug reports: thanks to all of you! Significant bug fixes were provided by James Bullard, Éric Durand, -Olivier François, Bret Larget, Klaus Schliep, Li-San Wang, and -Yan Wong. Contact me if I forgot someone. +Olivier François, Bret Larget, Elizabeth Purdom, Klaus Schliep, +Li-San Wang, and Yan Wong. Contact me if I forgot someone. Kurt Hornik, of the R Core Team, helped in several occasions to fix some problems and bugs. -- 2.39.2