getmatrix (phytree)

Convert phytree object into relationship matrix

Syntax

[Matrix, ID, Distances] = getmatrix(PhytreeObj)

Arguments

PhytreeObjphytree object created by phytree (object constructor).

Description

[Matrix, ID, Distances] = getmatrix(PhytreeObj) converts a phytree object, PhytreeObj, into a logical sparse matrix, Matrix, in which 1 indicates that a branch node (row index) is connected to its child (column index). The child can be either another branch node or a leaf node. ID is a column vector of strings listing the labels that correspond to the rows and columns of Matrix, with the labels from 1 to Number of Leaves being the leaf nodes, then the labels from Number of Leaves + 1 to Number of Leaves + Number of Branches being the branch nodes, and the label for the last branch node also being the root node. Distances is a column vector with one entry for every nonzero entry in Matrix traversed column-wise and representing the distance between the branch node and the child.

Examples

 T = phytreeread('pf00002.tree')
 [MATRIX, ID, DIST] = getmatrix(T); 
 

More About

Was this topic helpful?