本文整理汇总了Python中dendropy.Tree.length方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.length方法的具体用法?Python Tree.length怎么用?Python Tree.length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dendropy.Tree
的用法示例。
在下文中一共展示了Tree.length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_sum_of_branches
# 需要导入模块: from dendropy import Tree [as 别名]
# 或者: from dendropy.Tree import length [as 别名]
def get_sum_of_branches(treepath):
fin = open(treepath, "r")
newick = fin.readline().strip()
t = Tree()
t.read_from_string(newick.__str__(), "newick")
fin.close()
return t.length()
示例2: Tree
# 需要导入模块: from dendropy import Tree [as 别名]
# 或者: from dendropy.Tree import length [as 别名]
import os
import sys
from dendropy import Tree
t1path = sys.argv[1]
t2path = sys.argv[2]
t1 = Tree()
t1.read_from_path(t1path, "newick")
t2 = Tree()
t2.read_from_path(t2path, "newick")
s = t1.symmetric_difference(t2)
s = t2.symmetric_difference(t1)
print "symmetric diff. = ", s
print t1.length()
print t2.length()
示例3: get_tree_length
# 需要导入模块: from dendropy import Tree [as 别名]
# 或者: from dendropy.Tree import length [as 别名]
def get_tree_length(path):
"""Input: path to newick tree. Returns the sum of branches on the tree."""
t = Tree()
t.read_from_path(path, "newick")
return t.length()