Description Usage Details Examples
Returns a list object of nodes with information on each node – see details.
1 | getTreeStats(tree)
|
Many functions require the navigation of a tree e.g.
finding all descending nodes, counting number of children by node
etc. MoreTreeTools
has many functions for performing these
tasks, but in cases where these function need to be run multiple
times it can be more efficient to generate this information beforehand.
A list object is returned, with stats for each node. Stats generated are:
All nodes from root to node, ascend.nodes
All edges from root to edge, ascend.edges
Direct previous node connecting to node, prev.nodes
Direct previous edges connecting to node, prev.edges
Tips descending from node, children
Number of tips descending from node, n.children
Age of node, age
Phylogenetic diversity of node, pd
Note, this function assumes trees are rooted. If no branch lengths are
given, the function sets all branch lengths to 1. The function is
recursive, for very large trees (100,000 + tips) a stack overflow warning
may appear. Update options(expressions=)
to change the stack limit.
1 2 3 4 5 6 7 8 9 | # get hominoids tree
data ('hominoids')
# plot with labels
plot (hominoids);nodelabels();edgelabels();axisPhylo();
# generate tree.stats
tree.stats <- getTreeStats (hominoids)
# corroborate with plot
tree.stats[[19]][['prev.edges']] # the previous edge for node 19 is 2
tree.stats[[20]][['children']] # all the 'great' apes descend from node 20
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.