本文整理汇总了Python中ete2.TreeStyle.complete_branch_lines_when_necessary方法的典型用法代码示例。如果您正苦于以下问题:Python TreeStyle.complete_branch_lines_when_necessary方法的具体用法?Python TreeStyle.complete_branch_lines_when_necessary怎么用?Python TreeStyle.complete_branch_lines_when_necessary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ete2.TreeStyle
的用法示例。
在下文中一共展示了TreeStyle.complete_branch_lines_when_necessary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visualizeTree
# 需要导入模块: from ete2 import TreeStyle [as 别名]
# 或者: from ete2.TreeStyle import complete_branch_lines_when_necessary [as 别名]
def visualizeTree(sTreePath, pathToSfamilies, bootValue, width, height):
# Random tree
stree = Tree()
stree = readTreeFromFile(sTreePath)
snodesStatDic={}
snodesStatDic= getFamiliesStatisticsForEachNode(pathToSfamilies, bootValue)
#print snodesStatDic
# Some random features in all nodes
for n in stree.traverse():
if n.name in snodesStatDic.keys():
total= reduce(lambda x,y: x+y, snodesStatDic[n.name])
#norm= [(x*100)/total for x in snodesStatDic[n.name]]
norm= [x for x in snodesStatDic[n.name]]
n.add_features(pie_data=norm)
# Create an empty TreeStyle
ts = TreeStyle()
# Set our custom layout function
ts.layout_fn=layout
# Draw a tree
ts.mode = "r"
#ts.force_topology= False
ts.complete_branch_lines_when_necessary= True
# We will add node names manually
ts.show_leaf_name = False
# Show branch data
#ts.show_branch_length = True
#ts.show_branch_support = True
return stree, ts