subtree.length {phybase} | R Documentation |
calculate the total branch length of a sub-tree under inode
.
subtree.length(inode, nodes, nspecies)
inode |
the root node of the sub-tree |
nodes |
the tree node matrix |
nspecies |
the number of species in the tree |
The node matrix is the output of the function read.unrooted.nodes or read.rooted.nodes. The function can calculate the total branch length of a tree if inode is set to be the root node. If inode is not the root node, subtree.length calculates the total branch length of a sub-tree.
The function returns the total branch length of a sub-tree.
Liang Liu lliu@oeb.harvard.edu
tree.string<-"(((H:4.2,C:4.2):3.1,G:7.3):6.3,O:13.5);" nodes<-read.tree.nodes(tree.string)$nodes subtree.length(6,nodes,4)