The function read.newick
reads a simple Newick style tree from file.
The function readNexus
reads a Nexus formatted tree, optionally with bootstrap values as node labels.
read.newick(file="", text, ...)
readNexus(file="", format=c("standard","raxml"))
An object of class "phylo"
, possibly containing singles (see collapse.singles
); or an object of class "multiPhylo"
.
name of text file with single Newick style tree or multiple trees, one per line. For readNexus
this should be a Nexus format tree.
character string containing tree.
file format (source) for readNexus
. In the case of format="standard"
, read.nexus
from ape will be used internally. For format="raxml"
, the parser assumes that bootstrap values have been stored as node labels in the format [&label=bootstrap]
.
optional arguments to be passed to scan
. Note that if the arguments sep
or what
are supplied this could generate an error. Useful optional arguments might include skip
(number of lines to skip) and nlines
(number of lines to read).
Liam Revell liam.revell@umb.edu
The function read.newick
is almost completely redundant with read.tree
. At the time of development, it was more 'robust' than read.tree
in that it didn't fail if the tree contained so-called 'singles' (nodes with only one descendant); however, read.tree
can now handle singleton nodes without difficulty.
The function readNexus
can read a Nexus formatted tree from file (like read.nexus
); however, it can also parse the node labels as bootstrap values. This is the output format from the software RAxML. For Nexus tree files with complex node labels (e.g., from the software MrBayes) it will probably fail to parse node labels correctly, if at all.
Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.
read.tree
, read.nexus
tree<-"((Human,Chimp),Gorilla),Monkey);"
phy<-read.newick(text=tree)
Run the code above in your browser using DataLab