The TreeMan object in R is an S4 formal class whose foremost information slot is an inventory—which in R is a vector whose components might be named.
All nodes in a TreeMan object are named components in this record (ndlst). Each node normally incorporates the next information slots: the node ID (id), the size of the previous edge (spn, for “span”), the IDs of all connecting ascending/ancestral nodes to root (pre-node IDs, prid), the IDs of the instantly descending nodes (post-node IDs, ptid), and the IDs of all descending ideas (youngsters).
Additionally, if all nodes in a tree comprise the spn slot, then every node may also comprise: the entire edge size of all descending nodes (phylogenetic range, pd), whole edge size of all linked pre-nodes (prdst; in a rooted tree this is the root-to-tip distance), and the relative distance of the node in the tree (age, for a time-calibrated rooted tree).
All nodes will need to have both a prid and/or ptid information slots: tip nodes have solely prid slots, root nodes have solely ptid slots, and inside nodes have each. These slots should comprise IDs which might be discovered throughout the ndlst; if they don’t, an error is raised.
These core slots are supplemented by non-compulsory slots, a non-unique taxonomic identify that can be utilized to generate lineages (txnym) and user-defined slots that may comprise any type of data. In addition to the ndlst, the TreeMan object incorporates informative slots which might be generated upon studying or producing the tree, and are up to date at any time when modified. Basic tree data might be seen by printing the tree to console.
The treeman bundle implements an intuitive naming conference in which every tree characteristic has a particular identify that each one strategies and objects should use Specific tree or node data might be accessed utilizing R indexing by character-string. For instance, coming into tree [“tips”] will output information on a tree’s ideas.
Double sq. brackets are used for pulling out data on particular person nodes, e.g. tree [[“t1”]] will return node data on tip/node t1. The majority of strategies in the treeman bundle are grouped into 4 foremost teams: get, set, calc and manip .
The get strategies return node or tree particular data, set strategies change the tree’s or its nodes’ parameters, calc strategies generate tree statistics, and manip strategies alter the tree, normally by including or eradicating ideas and nodes. Methods that act throughout nodes are indicated with ‘nd’ or ‘nds’ in their operate identify, e.g. getNdAge() for a single node and getNdsAge() for a number of nodes.
These core strategies are designed to be quick and modular, permitting them to be readily mixed into extra complicated capabilities. For instance, evolutionary distinctness utilizing the Fair Proportion metric might be calculated by utilizing the strategy calcFrPrp(). In implementation, this technique makes use of getNdPrid() to get all pre-node IDs, runs getNdsKids() on these IDs to search out the variety of descendants per pre-node, after which sums the division of the numbers of descendants over the pre-nodes’ spans.