-## read.nexus.R (2011-03-26)
+## read.nexus.R (2012-09-28)
## Read Tree File in Nexus Format
-## Copyright 2003-2011 Emmanuel Paradis and 2010 Klaus Schliep
+## Copyright 2003-2012 Emmanuel Paradis and 2010 Klaus Schliep
## This file is part of the R-package `ape'.
## See the file ../COPYING for licensing issues.
names(phy) <- nms
if (all(phy$node.label == "")) phy$node.label <- NULL
class(phy) <- "phylo"
+ attr(phy, "order") <- "cladewise"
phy
}
if (all(obj$node.label == "NA")) NULL
else gsub("^NA", "", obj$node.label)
class(obj) <- "phylo"
+ attr(obj, "order") <- "cladewise"
obj
}
if (!translation) n <- length(tr$tip.label)
ROOT <- n + 1
if (sum(tr$edge[, 1] == ROOT) == 1 && dim(tr$edge)[1] > 1) {
- stop(paste("There is apparently two root edges in your file: cannot read tree file.\n Reading NEXUS file aborted at tree no.", i, sep = ""))
+ stop(paste("The tree has apparently singleton node(s): cannot read tree file.\n Reading NEXUS file aborted at tree no.", i, sep = ""))
}
}
if (Ntree == 1) {
class(trees) <- "multiPhylo"
if (!all(nms.trees == "")) names(trees) <- nms.trees
}
- if (length(grep("[\\/]", file)) == 1)
- if (!file.exists(file)) # suggestion by Francois Michonneau
- file <- paste(getwd(), file, sep = "/")
- attr(trees, "origin") <- file
trees
}