readNexus {phylobase} | R Documentation |
readNexus
reads a Nexus file and outputs a phylo4
or phylo4d
object.
readNexus(file, simplify=TRUE, type=c("all", "tree", "data"), char.all=FALSE, polymorphic.convert=TRUE, levels.uniform=TRUE, quiet=TRUE, check.node.labels=c("keep", "drop", "asdata"), ...)
file |
a Nexus file |
simplify |
If FALSE, returns a list. If TRUE, returns a list if there are multiple trees, a single object otherwise |
type |
Determines which type of objects to return, if present |
char.all |
If TRUE, returns all characters, even those excluded in the NEXUS file |
polymorphic.convert |
If TRUE, converts polymorphic DNA characters to missing data |
levels.uniform |
If TRUE, uses the same levels for all characters |
quiet |
If FALSE the tree string is printed. This is mainly for debugging purposes. This option can considerably slow down the process if the tree is big or there are many trees in the file. |
check.node.labels |
Determines how the node labels in the Nexus files should be treated in the phylo4 object, see Details for more information. |
... |
Additional arguments to be passed to phylo4 or phylo4d constructor (see details) |
The options for check.node.labels
can take the values:
If you use the option asdata
on a file with no node labels, a
warning message is issued and by default check.node.labels
takes
the value drop
.
Depending on the context readNexus
will call either the
phylo4
or phylo4d
constructor. The phylo4d
constructor will be used if check.node.labels="asdata"
or if
type="all"
; and the phylo4
constructor will be used
otherwise. Additional arguments can be passed to the constructors such
as annote
, missing.data
or extra.data
. See the
documentation of phylo4-methods, phylo4d and
formatData for the complete list of arguments.
A phylo4 object if there is no data in the Nexus file
and if the option check.node.labels
is “keep” or
“drop”, or a phylo4d object otherwise.
If several trees are included in the Nexus file and the option
simplify=FALSE
a list of phylo4 or
phylo4d objects is returned.
This relies on Version 2.0 of the Nexus Class Library by Paul Lewis
and Mark Holder. Tree reading is done initially using internal
APE
functions; these functions can be confused if tree names
include the word (“tree”) in them.
Brian O'Meara, Derrick Zwickl
the phylo4d class, the phylo4 class