]> git.donarmstrong.com Git - ape.git/blobdiff - R/read.nexus.R
faster rcoal... at last!
[ape.git] / R / read.nexus.R
index 01aec6495d560e7dc5ef15386f062941ad0e2af0..3edcd3f5903b610f42edce93884ad2665cb640a0 100644 (file)
@@ -1,8 +1,8 @@
-## read.nexus.R (2008-11-24)
+## read.nexus.R (2009-04-01)
 
 ##   Read Tree File in Nexus Format
 
-## Copyright 2003-2008 Emmanuel Paradis
+## Copyright 2003-2009 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -154,7 +154,7 @@ read.nexus <- function(file, tree.names = NULL)
     rm(X)
     tree <- gsub("^.*= *", "", tree)
     ## check whether there are empty lines from the above manips:
-    tree <- tree[tree == ""]
+    tree <- tree[tree != ""]
     semico <- grep(";", tree)
     Ntree <- length(semico)
     ## are some trees on several lines?
@@ -228,7 +228,8 @@ read.nexus <- function(file, tree.names = NULL)
         class(trees) <- "multiPhylo"
     }
     if (length(grep("[\\/]", file)) == 1)
-        file <- paste(getwd(), file, sep = "/")
+        if (!file.exists(file)) # suggestion by Francois Michonneau
+            file <- paste(getwd(), file, sep = "/")
     attr(trees, "origin") <- file
     trees
 }