]> git.donarmstrong.com Git - ape.git/commitdiff
fix bug in read.nexus()
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Mon, 24 Nov 2008 08:30:45 +0000 (08:30 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Mon, 24 Nov 2008 08:30:45 +0000 (08:30 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@55 6e262413-ae40-0410-9e79-b911bd7a66b7

ChangeLog
DESCRIPTION
R/read.nexus.R
Thanks

index 1a6a7ab27005480defebf00ab8ffda6ac9b5faf0..8891e33091e47f5e69e6c3dce93857bb91a74b69 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@ BUG FIXES
 
     o chronopl() did not work with CV = TRUE.
 
+    o read.nexus() did not work correctly in some situations (trees on
+      multiple lines with different numbers of lines and/or with
+      comments inserted within the trees).
+
 
 
                CHANGES IN APE VERSION 2.2-2
index c2fab9ef69ee73eac7f6b09e6eae6c6fc86a2ac1..74b1a1d401d9965794eebca66816da0fb12c52b8 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
 Version: 2.2-3
-Date: 2008-11-04
+Date: 2008-11-24
 Title: Analyses of Phylogenetics and Evolution
 Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong,
   Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel,
index cbf0f20e7a42ff1bc6bd2c90090c695477995f47..01aec6495d560e7dc5ef15386f062941ad0e2af0 100644 (file)
@@ -1,4 +1,4 @@
-## read.nexus.R (2008-09-17)
+## read.nexus.R (2008-11-24)
 
 ##   Read Tree File in Nexus Format
 
@@ -153,6 +153,8 @@ read.nexus <- function(file, tree.names = NULL)
     tree <- X[start:end]
     rm(X)
     tree <- gsub("^.*= *", "", tree)
+    ## check whether there are empty lines from the above manips:
+    tree <- tree[tree == ""]
     semico <- grep(";", tree)
     Ntree <- length(semico)
     ## are some trees on several lines?
@@ -161,8 +163,13 @@ read.nexus <- function(file, tree.names = NULL)
             STRING <- character(Ntree)
             s <- c(1, semico[-Ntree] + 1)
             j <- mapply(":", s, semico)
-            for (i in 1:Ntree)
-                STRING[i] <- paste(tree[j[, i]], collapse = "")
+            if (is.list(j)) {
+                for (i in 1:Ntree)
+                    STRING[i] <- paste(tree[j[[i]]], collapse = "")
+            } else {
+                for (i in 1:Ntree)
+                    STRING[i] <- paste(tree[j[, i]], collapse = "")
+            }
         } else STRING <- tree
     }
     rm(tree)
diff --git a/Thanks b/Thanks
index 0bac63663b2b3141d45b0f75946861a4dbe8c023..adf40fda71e010dc63cd7a84188a4f4312ef78e5 100644 (file)
--- a/Thanks
+++ b/Thanks
@@ -4,9 +4,10 @@ APE at one stage or another.
 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, Elizabeth Purdom, Klaus Schliep,
-Li-San Wang, and Yan Wong. Contact me if I forgot someone.
+Significant bug fixes were provided by Cécile Ané, James Bullard,
+Éric Durand, 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.