]> git.donarmstrong.com Git - ape.git/commitdiff
bug fix in read.nexus()
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 24 Jun 2008 09:51:36 +0000 (09:51 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 24 Jun 2008 09:51:36 +0000 (09:51 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@37 6e262413-ae40-0410-9e79-b911bd7a66b7

Changes
DESCRIPTION
R/read.nexus.R

diff --git a/Changes b/Changes
index df065d469e97c0c7137e25500db9683358da3f92..e2ea0afc2ed7cc181f46009b3ae33478567f8eef 100644 (file)
--- a/Changes
+++ b/Changes
@@ -15,7 +15,9 @@ BUG FIXES
     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.
+      'node.labels' elements (thanks to Elizabeth Purdom for the fix).
+
+    o read.nexus failed to remove correctly the comments within trees.
 
 
 OTHER CHANGES
index 71e4a76ad6915873bc7c82aaa7e5b63e628cd0e7..5f5dcf0f6f9cae0767177f73a88afd8fd63419f4 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
 Version: 2.2-1
-Date: 2008-06-19
+Date: 2008-06-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 ff148df2eaa1ff9b419f346c3f64d8cc14611718..05acfcde7025139d52aebc40d1d279ba8733657f 100644 (file)
@@ -1,4 +1,4 @@
-## read.nexus.R (2008-02-28)
+## read.nexus.R (2008-06-24)
 
 ##   Read Tree File in Nexus Format
 
@@ -109,7 +109,17 @@ read.nexus <- function(file, tree.names = NULL)
         w <- LEFT == RIGHT
         if (any(w)) { # in case all comments use at least 2 lines
             s <- LEFT[w]
-            X[s] <- gsub("\\[.*\\]", "", X[s])
+            X[s] <- gsub("\\[[^]]*\\]", "", X[s])
+            ## The previous 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:
+            ##       \\[      [^]]*       \\]
+            ## where [^]]* means "any character, except "]", repeated zero
+            ## or more times" (note that the ']' is not escaped here).
+            ## The previous version was:
+            ##       X[s] <- gsub("\\[.*\\]", "", X[s])
+            ## which deleted the "xxx". (EP  2008-06-24)
         }
         w <- !w
         if (any(w)) {