pdist (phytree)

Calculate the pairwise patristic distances in a phytree object

Syntax

D = pdist(Tree)
D = pdist(..., 'Nodes', NodeValue)
D = pdist(... ,'Squareform', SquareformValue)
D = pdist(...,'Criteria', CriteriaValue)
[D,C] = pdist(Tree)

Arguments

TreePhylogenetic tree object created with the function phytree (phytree).
NodeValueProperty to select the nodes. Enter either'leaves' (default) or 'all'.
SquareformValueProperty to control creating a square matrix.

Description

D = pdist(Tree) returns a vector (D) containing the patristic distances between all pairs of leaf nodes in a phygtree object (Tree). The patristic path distances are computed by following paths through the branches of the tree and adding the patristic branch distances originally created with seqlinkage.

The output vector D is arranged in the order ((2,1),(3,1),..., (M,1),(3,2),...(M,3),.....(M,M-1)) (the lower left triangle of the full M-by-M distance matrix). To get the distance between the Ith and Jth nodes (I > J), use the formula D((J-1)*(M-J/2)+I-J). M is the number of leaves).

D = pdist(..., 'Nodes', NodeValue) indicates the nodes included in the computation. When Node='leaves', the output is ordered as before, but M is the total number of nodes in the tree ( NumLeaves+NumBranches).

D = pdist(... ,Squareform', SquareformValue), when Squareform is true, converts the output into a square formatted matrix, so that D(I,J) denotes the distance between the Ith and the Jth nodes. The output matrix is symmetric and has a zero diagonal.

D = pdist(...,'Criteria', CriteriaValue) changes the criteria used to relate pairs. C can be 'distance' (default) or 'levels'.

[D,C] = pdist(Tree) returns in C the index of the closest common parent nodes for every possible pair of query nodes.

Examples

% get the tree distances between pairs of leaves
tr = phytreeread('pf00002.tree')
dist = pdist(tr,'nodes','leaves','squareform',true)

See Also

Bioinformatics Toolbox function seqpdist, seqlinkage and the phytree object methods phytree (phytree), phytreetool


© 1994-2005 The MathWorks, Inc.