read.newick: Newick or Nexus style tree reader

View source: R/read.newick.R

read.newickR Documentation

Newick or Nexus style tree reader

Description

Reads a phylogenetic tree from file.

Usage

read.newick(file="", text, ...)
readNexus(file="", format=c("standard","raxml"))

Arguments

file

name of text file with single Newick style tree or multiple trees, one per line. For readNexus this should be a Nexus format tree.

text

character string containing tree.

format

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

Details

The function read.newick reads a simple Newick style tree from file. This function is now almost completely redundant with read.tree. At the time of development, however, 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 reads a Nexus formatted tree, optionally with bootstrap values as node labels. This function can read a simple 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.

Value

An object of class "phylo", possibly containing singletons (see collapse.singles); or an object of class "multiPhylo".

Author(s)

Liam Revell liam.revell@umb.edu

References

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

See Also

read.tree, read.nexus

Examples

tree<-"((Human,Chimp),Gorilla),Monkey);"
phy<-read.newick(text=tree)

phytools documentation built on June 22, 2024, 10:39 a.m.