Main Content


Remove branch nodes from phylogenetic tree


T2 = prune(T1, Nodes)
T2 = prune(T1, Nodes, 'Mode','Exclusive')


T1Phylogenetic object created with the phytree constructor function.

Nodes to remove from tree.


Property to control the method of pruning. Enter either 'Inclusive' or 'Exclusive'. The default value is 'Inclusive'.


T2 = prune(T1, Nodes)removes the nodes listed in the vector Nodes from the tree T1. prune removes any branch or leaf nodes listed in Nodes and all their descendants from the tree T1, and returns the modified tree T2. The parent nodes are connected to the 'brothers' as required. Nodes in the tree are labeled as [1:numLeaves] for the leaves and as [numLeaves+1:numLeaves+numBranches] for the branches. Nodes can also be a logical array of size [numLeaves+numBranches x 1] indicating the nodes to be removed.

T2 = prune(T1, Nodes, 'Mode','Exclusive') changes the Mode property for pruning to 'Exclusive' and removes only the descendants of the nodes listed in the vector Nodes. Nodes that do not have a predecessor become leaves in the list Nodes. In this case, pruning is the process of reducing a tree by turning some branch nodes into leaf nodes, and removing the leaf nodes under the original branch.


Load a phylogenetic tree created from a protein family

tr = phytreeread('pf00002.tree');

Remove all the 'mouse' proteins

ind = getbyname(tr,'mouse');
tr = prune(tr,ind);

Remove potential outliers in the tree

[sel,sel_leaves] = select(tr,'criteria','distance',...
tr = prune(tr,~sel_leaves)

Version History

Introduced before R2006a