read.nexus {ape} | R Documentation |
This function reads one or several trees in a NEXUS file.
read.nexus(file, tree.names = NULL)
file |
a file name specified by either a variable of mode character, or a double-quoted string. |
tree.names |
if there are several trees to be read, a vector of
mode character that gives names to the individual trees; if
NULL (the default), the trees are named "tree1" ,
"tree2" , ... |
The present implementation tries to follow as much as possible the
NEXUS standard. Only the block "TREES" is read; the other data can be
read with other functions (e.g., read.dna
,
read.table
, ...). A trace of the original data is
kept with the attribute "origin"
(see below).
an object of class "phylo"
with the following components:
edge |
a two-column matrix of mode character where each row
represents an edge of the tree; the nodes and the tips are
symbolized with numbers (these numbers are not treated as numeric,
hence the mode character); the nodes are represented with negative
numbers (the root being "-1" ), and the tips are represented with
positive numbers. For each row, the first column gives the
ancestor. This representation allows an easy manipulation of the
tree, particularly if it is rooted. |
edge.length |
a numeric vector giving the lengths of the
branches given by edge . |
tip.label |
a vector of mode character giving the names of the
tips; the order of the names in this vector corresponds to the
(positive) number in edge . |
node.label |
(optional) a vector of mode character giving the
names of the nodes (set to NULL if not available in the file). |
root.edge |
(optional) a numeric value giving the length of the
branch at the root is it exists (NULL otherwise). |
If several trees are read in the file, the returned object is of class
c("phylo", "multi.tree")
, and is a list of objects of class
"phylo"
.
An attribute "origin"
is further given to the returned object
which gives the name of the source file (with its path). This is used
to write a tree in a NEXUS file where all the original data must be
written (not only the tree) in accordance to the specifications of
Maddison et al. (1997).
Emmanuel Paradis paradis@isem.univ-montp2.fr
Maddison, D. R., Swofford, D. L. and Maddison, W. P. (1997) NEXUS: an extensible file format for systemaric information. Systematic Biology, 46, 590621.
read.tree
, write.nexus
,
write.tree