matTree: Transform a phylo object into a matrix.

Description Usage Arguments Value Author(s) Examples

View source: R/tree_matTree.R

Description

matTree transforms a phylo tree into a matrix. The entry of the matrix is node number. Each row represents a path connecting a leaf node and the root. The columns are arranged in the order as the path passing the nodes to reach the root.

Usage

1
matTree(tree)

Arguments

tree

A phylo object

Value

A matrix

Author(s)

Ruizhu Huang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(ggtree)

data(tinyTree)
ggtree(tinyTree, branch.length = 'none') +
 geom_text2(aes(label = node))


# each row of the matrix representing a path.
# the first column is leaf nodes; the last non-NA value in a row is the root
mat <- matTree(tree = tinyTree)

fionarhuang/TreeSummarizedExperiment documentation built on Aug. 18, 2021, 12:15 p.m.