skbio.tree.TreeNode.tip_tip_distances

TreeNode.tip_tip_distances(endpoints=None)[源代码]

返回尖端对之间的距离矩阵,以及尖端顺序。

状态:从0.4.0开始实验。

默认情况下,在树中计算所有成对距离。如果 endpoints 则只计算这些尖端之间的距离。

参数:

endpoints (list of TreeNode or str, or None) -- TreeNode对象的列表或TreeNode对象的名称

返回:

距离矩阵

返回类型:

DistanceMatrix

抛出:

ValueError -- 如果 endpoints 不是小费

备注

如果节点没有关联的长度,将使用0.0和 RepresentationWarning 将被提升。

示例

>>> from skbio import TreeNode
>>> tree = TreeNode.read(["((a:1,b:2)c:3,(d:4,e:5)f:6)root;"])
>>> mat = tree.tip_tip_distances()
>>> print(mat)
4x4 distance matrix
IDs:
'a', 'b', 'd', 'e'
Data:
[[  0.   3.  14.  15.]
 [  3.   0.  15.  16.]
 [ 14.  15.   0.   9.]
 [ 15.  16.   9.   0.]]