Learn R Programming

phyreg (version 0.7)

Translating phylogenies: Using phylogenies formatted in standard but "other" ways

Description

The two functions convert phylogenies in a standard format (newick or phylo) into a form that can be supplied as the argument phydata of phyreg. If node heights are specified, these are also provided in the value returned.

Usage

phyfromnewick(file = "", str,datatype="Branch_lengths") phyfromphylo(phylo)

Arguments

file
a textfile containing the newick phylogeny
str
a character variable containing the newick phylogeny. Exactly one of these arguments should be supplied. (phyfromnewick only)
datatype
The newick object can give branch lengths (by including a colon and a number after each species and after each higher node except the root), or node heights (by doing so for every node including the root). The function looks for the kind of data suggested by this argument. If there are no numbers, or not all required nodes have them, then they are simply discarded and no heights are returned. (phyfromnewick only)
phylo
an R-name containing a "phylo" object, as used, for example, in the ape package The phylo object must have edge.length values if heights are to be provided by phyfromphylo. (phyfromphylo only).

Value

phy
The phylogenetic vector in internal format, with an element for every node, except the root, but including species. If jj==phy[[ii]], then jj is the parent-node of ii. It is a requirement for the internal format that jj>ii in every case (it is not true of "phylo" objects that a parent's ID has to be greater than its offspring's). Suitable for supplying as the phydata argument of phyreg
hts
The heights of each node, a vector with an element for every node. Thus it is longer by one than $phy. Suitable for supplying as the heightsdata argument of phyreg. NOTE: this will be returned only if the information is available in the inputs.
firstphy
A newick object may have higher nodes with only one daughter. firstphy contains the corresponding internally formatted phylogeny. phy itself has all singletons removed, and the numbers of the higher nodes are therefore altered. (phylofromnewick only)
sd
Species data as read from the newick object. It contains a name (Species_1 etc if none are supplied), the ID number, and the additional data that, if numeric and provided for all relevant nodes, will be interpreted as branch lengths or heights. This may be useful if numerical data is not getting through for some reason (phylofromnewick only)
oh
Higher node data as read from the newick object. This contains the higher node names (Higher_Node_1 etc by default), their ID numbers in firstphy not in phy, and the additional data. Again, perhaps useful for checking. (phylofromnewick only)

Details

newick and phylo formats are both widely-used standards. Examples of the functions are given under phyreg.

Both standards can be constructed to contain singleton higher nodes i.e. a higher node with only one daughter. phyfromphylo leaves the singletons in. phyfromnewick strips them out. phyreg will use either.

References

For newick format, see http://en.wikipedia.org/wiki/Newick_format. For phylo objects, so far as I can see invented by Diaconis, P.W. and S.P. Holmes (1998, PNAS 95, 14600--14602), see the ape package (http://cran.r-project.org/web/packages/ape/).

See Also

phyreg