Description Usage Arguments Details Value Author(s) Examples
View source: R/phylostructure.R
phylostructure
returns the neighboring nodes and descendant leaves
for each internal node of a binary phylogenetic tree.
1 | phylostructure(phylotree)
|
phylotree |
A |
For each internal node (i.e. non-leaf node) in phylotree
,
this function calculates its parent node, child nodes and all of its descendant
leaves. The labeling of nodes are the same as in phylotree$edge
, which is
assumed to obey the following convention. Leaves are labeled from 1
to
ntaxa(phylotree)
and internal nodes are labeled from
ntaxa(phylotree) + 1
to ntaxa(phylotree) + phylotree$Nnode
. The
root label is ntaxa(phylotree) + 1
. Parent node always has a lower label
than its child internal nodes.
A list containing the following components:
|
Input object |
|
Numerical matrix of child node labels. The kth row contains the children node labels of node k. Leaf nodes have their their row vectors set to zero. |
|
Numerical vector of parent node labels. The kth element contains the parent node label of node k. Root node has its parent set to zero. |
|
Logical matrix of decendant leaves. The kth row shows whether the leaves are descendants of node k. |
Yunfan Tang
1 2 3 4 5 6 7 8 9 10 11 | library(ape)
set.seed(10)
## Analyze a random binary phylogenetic tree with 6 leaf nodes
pstrct <- phylostructure(rtree(6))
## Show children of node 7 (root):
pstrct$phylochildren[7, ]
## Show parent of node 1:
pstrct$phyloparent[1]
## List all leaf nodes under node 8:
which(pstrct$descendant[8, ])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.