Phylogenetic trees are commonly used to present evolutionary relationships of species. Newick is the de facto format in phylogenetic for representing tree(s). Nexus format incorporates Newick tree text with related information organized into separated units known as blocks. For the R community, we have ape and phylobase packages to import trees from Newick and Nexus formats. However, analysis results (tree + analysis findings) from widely used software packages in this field are not well supported. Some of them are extended from Newick and Nexus (e.g. RevBayes and BEAST outputs), while some of the others are just log files (e.g. r8s and PAML outputs). Parsing these output files is important for interpreting analysis findings.
Information associated with taxon species/strains can be meta-data (e.g. isolation host, time and location, etc.), phenotypic or experimental data. These data as well as analysis finding may be further analyzed in the evolutionary context for downstream integrative and comparative studies. Unfortunately, taxon-associated data are mostly stored in separate files and often in inconsistent formats. To fill this gap, I developed the treeio package for phylogenetic tree data integration.
Currently, treeio is able to read the following file formats: Newick, Nexus, New Hampshire eXtended format (NHX), jplace and Phylip as well as the data outputs from the following analysis programs: BEAST, EPA, HyPhy, MrBayes, PAML, PHYLDOG, pplacer, r8s, RAxML and RevBayes.
Installation
The treeio package is released within Bioconductor project.
To get the released version from Bioconductor:
## try http:// if https:// URLs are not supported
source(&quot;https://bioconductor.org/biocLite.R&quot;)
biocLite(&quot;treeio&quot;)
Or the development version from github:
## install.packages(&quot;devtools&quot;)
devtools::install_github(&quot;GuangchuangYu/treeio&quot;)
Importing trees with data
Importing tree data from software outputs
The treeio package provides several parser functions as illustrated in the following table:
Parser function
Description
read.beast
parsing output of BEAST
read.codeml
parsing output of CodeML (rst and mlc files)
read.codeml_mlc
parsing mlc file (output of CodeML)
read.hyphy
parsing output of HYPHY
read.jplace
parsing jplace file including output of EPA and pplacer
read.mrbayes
parsing output of MrBayes
read.newick
parsing newick string, with ability to parse node label as support values
read.nhx
parsing NHX file including output of PHYLDOG and RevBayes
read.paml_rst
parsing rst file (output of BaseML or CodeML)
read.phylip
parsing phylip file (phylip alignment + newick string)
read.r8s
parsing output of r8s
read.raxml
parsing output of RAxML
For example, users can parse BEAST output using read.beast function. All the information inferred by by BEAST will be stored in the output object.
file