read.nexus

0th

Percentile

Read Tree File in Nexus Format

This function reads one or several trees in a NEXUS file.

Keywords
manip, IO
Usage
read.nexus(file, tree.names = NULL)
Details

The present implementation tries to follow as much as possible the NEXUS standard (but see the restriction below on TRANSLATION tables). 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).

If a TRANSLATION table is present it is assumed that only the tip labels are translated and they are all translated with integers without gap. Consequently, if nodes have labels in the tree(s) they are read as they are and not looked for in the translation table. The logic behind this is that in the vast majority of cases, node labels will be support values rather than proper taxa names. This is consistent with write.nexus which translates only the tip labels.

`read.nexus' tries to represent correctly trees with a badly represented root edge (i.e. with an extra pair of parentheses). For instance, the tree "((A:1,B:1):10);" will be read like "(A:1,B:1):10;" but a warning message will be issued in the former case as this is apparently not a valid Newick format. If there are two root edges (e.g., "(((A:1,B:1):10):10);"), then the tree is not read and an error message is issued.

Value

an object of class "phylo" with the following components:edgea 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.lengtha numeric vector giving the lengths of the branches given by edge.tip.labela 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 "multiPhylo", and is a list of objects of class "phylo".

References

Maddison, D. R., Swofford, D. L. and Maddison, W. P. (1997) NEXUS: an extensible file format for systematic information. Systematic Biology, 46, 590--621.

See Also

read.tree, write.nexus, write.tree, read.nexus.data, write.nexus.data

Aliases
Documentation reproduced from package ape, version 3.0-2, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.