readNexus {phylobase}R Documentation

Create a phylo4 or a phylo4d object from a Nexus file

Description

readNexus reads a Nexus file and outputs a phylo4 or phylo4d object.

Usage

        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"), ...)
 

Arguments

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)

Details

The options for check.node.labels can take the values:

keep
the node labels of the Nexus file will be passed as node labels in the phylo4 object
drop
the node labels of the Nexus file will be ignored in the phylo4 object
asdata
the node labels will passed to the phylo4 object as data.

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.

Value

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.

Methods

x = "readNexus"
creates a phylo4 or phylo4d object from a Nexus file

Note

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.

Author(s)

Brian O'Meara, Derrick Zwickl

See Also

the phylo4d class, the phylo4 class


[Package phylobase version 0.5 Index]