parse_annotated {phylotate} | R Documentation |
Parse an annotated phylogenetic tree
Description
This function takes the given text string, containing data in either NEXUS or Newick format, and returns annotated phylogenetic trees.
Usage
parse_annotated(str, format="nexus")
Arguments
str |
a text string, containing tree data |
format |
a format specifier; either |
Details
The given file text is parsed and a tree object is constructed which can be used with the functions in the ape package. Annotations of the kind produced by, for example, MrBayes, are parsed and preserved in the returned object.
In addition to edge
, edge.length
and tip.label
,
two additional vectors are added. These are node.comment
and
node.distance.comment
. These contain annotations associated
with nodes and their distance values. These arrays are indexed by node
number, not by edge. The reason for this is that this ensures that the
object will remain in a valid state after a call to reorder
which might change the ordering of the edge arrays without being aware
of annotations. If you need to obtain annotations in edge-order,
subset by the second column of the edge
array.
Value
an object of type "phylo"
or "multiPhylo"
, augmented with
node annotations.
Author(s)
Daniel Beer dlbeer@gmail.com
References
Paradis, E. Definition of Formats for Coding Phylogenetic Trees in R. http://ape-package.ird.fr/misc/FormatTreeR_24Oct2012.pdf
See Also
print_annotated
,
read_annotated
,
write_annotated
,
finches
Examples
# Parse the example data included with this package
data(finches)
t <- parse_annotated(finches, format="nexus")
# Obtain annotations in edge-order, rather than node-order
edge.comment <- t$node.comment[t$edge[,2]]