From 35ab8b00668b0993d0e8221094555adc997518c1 Mon Sep 17 00:00:00 2001 From: paradis Date: Wed, 9 Jul 2008 07:36:08 +0000 Subject: [PATCH] bug fix in read.nexus() git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@41 6e262413-ae40-0410-9e79-b911bd7a66b7 --- Changes | 3 +++ DESCRIPTION | 2 +- R/read.nexus.R | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index 86d0131..2392e8a 100644 --- a/Changes +++ b/Changes @@ -30,6 +30,9 @@ BUG FIXES o read.nexus() failed to read a file with a single tree and no translation of tip labels. + o read.nexus() failed to place correctly tip labels when reading + a single tree with no edge lengths. + OTHER CHANGES diff --git a/DESCRIPTION b/DESCRIPTION index c511656..6b1df81 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.2-1 -Date: 2008-07-03 +Date: 2008-07-09 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/read.nexus.R b/R/read.nexus.R index 5438456..06acd2f 100644 --- a/R/read.nexus.R +++ b/R/read.nexus.R @@ -1,4 +1,4 @@ -## read.nexus.R (2008-07-04) +## read.nexus.R (2008-07-09) ## Read Tree File in Nexus Format @@ -110,7 +110,7 @@ read.nexus <- function(file, tree.names = NULL) if (any(w)) { # in case all comments use at least 2 lines s <- LEFT[w] X[s] <- gsub("\\[[^]]*\\]", "", X[s]) - ## The previous regexp was quite tough to find: it makes + ## The above regexp was quite tough to find: it makes ## possible to delete series of comments on the same line: ## ...[...]xxx[...]... ## without deleting the "xxx". This regexp is in three parts: @@ -208,7 +208,8 @@ read.nexus <- function(file, tree.names = NULL) } if (Ntree == 1) { trees <- trees[[1]] - if (translation) trees$tip.label <- TRANS[, 2] + if (translation) + trees$tip.label <- TRANS[, 2][as.numeric(trees$tip.label)] } else { if (!is.null(tree.names)) names(trees) <- tree.names if (translation) attr(trees, "TipLabel") <- TRANS[, 2] -- 2.39.5