pdist
Calculate pairwise patristic distances in phytree object
Description
returns
D = pdist(Tree)D, a vector containing the patristic distances between every possible
pair of leaf nodes of Tree, a phylogenetic tree object. The patristic
distances are computed by following paths through the branches of the tree and adding the
patristic branch distances originally created with the seqlinkage function.
specifies additional parameters using one or more name-value arguments for calculating
pairwise patristic distances in a D = pdist(___,Name=Value)phytree object.
Examples
Create a phytree object from a phylogenetic tree file.
tr = phytreeread('pf00002.tree')Phylogenetic tree object with 33 leaves (32 branches)
Calculate the patristic distances between pairs of leaves in the tree, and format the output as a square matrix.
dist = pdist(tr,Nodes="leaves",Squareform=true)dist = 33×33
0 0.2179 0.2834 0.3755 0.3775 0.4111 0.4374 0.5082 0.5337 0.5337 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.2179 0 0.2834 0.3755 0.3775 0.4111 0.4374 0.5082 0.5337 0.5337 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.2834 0.2834 0 0.3755 0.3775 0.4111 0.4374 0.5082 0.5337 0.5337 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.3755 0.3755 0.3755 0 0.3775 0.4111 0.4374 0.5082 0.5337 0.5337 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.3775 0.3775 0.3775 0.3775 0 0.4111 0.4374 0.5082 0.5337 0.5337 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.4111 0.4111 0.4111 0.4111 0.4111 0 0.4374 0.5082 0.5337 0.5337 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.4374 0.4374 0.4374 0.4374 0.4374 0.4374 0 0.5082 0.5337 0.5337 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.5082 0.5082 0.5082 0.5082 0.5082 0.5082 0.5082 0 0.5337 0.5337 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.5337 0.5337 0.5337 0.5337 0.5337 0.5337 0.5337 0.5337 0 0.3620 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.5337 0.5337 0.5337 0.5337 0.5337 0.5337 0.5337 0.5337 0.3620 0 0.5532 0.5532 0.5532 0.5532 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0 0.5071 0.5071 0.5071 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5071 0 0.4135 0.4570 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5071 0.4135 0 0.4570 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5532 0.5071 0.4570 0.4570 0 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0.6776 0 0.4545 0.5810 0.5810 0.6431 0.6431 0.7113 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.7832 0.8384
⋮
Input Arguments
Phylogenetic tree, specified as a phytree object.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: D = pdist(tree,Nodes="leaves",SquareForm=true)
Tree nodes included in the computation, specified as
"leaves" or "all".
By default, the value is "leaves" and the function computes the
distances between leaves only. The corresponding size of the squared output matrix is
M-by-M, where M is the
number of leaves.
If the value is "all", the function computes the distances
between leaves and internal nodes (branches), that is, the sum of the number of leaves
and number of branches. M is
NumLeaves+NumBranches. Use this option if you need distances
among internal nodes and leaf nodes.
Example: pdist(tr,Nodes="leaves")
Flag to return the output as a square matrix, specified as
false or true. If the value is
true, pdist 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.
Example: pdist(tr,Squareform=true)
Criteria used to relate pairs in computing distances, specified as
"distance" or "levels".
By default, the value is "distance", and the function returns
the patristic distances in the output argument D.
If the value is "levels", the function treats each branch as
having a unit length and returns count levels instead of computed patristic distances
in the output argument D.
Example: pdist(tr,CriteriaValue="levels")
Output Arguments
Pairwise patristic distances, returned as a numeric vector or matrix. It contains
the patristic distances between every possible pair of leaf nodes of
Tree. The numeric vector is arranged in the order ((2,1),
(3,1), ..., (M,1), (3,2), ..., (M,2), ..., (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.
Closest common parent node, returned as a numeric vector. It contains the indices of the closest common parent nodes for every possible pair of query nodes.
Version History
Introduced before R2006a
See Also
phytree | phytreeread | phytreeviewer | seqlinkage | seqpdist
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)