本文整理汇总了Python中ete3.Tree.iter_search_nodes方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.iter_search_nodes方法的具体用法?Python Tree.iter_search_nodes怎么用?Python Tree.iter_search_nodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ete3.Tree
的用法示例。
在下文中一共展示了Tree.iter_search_nodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from ete3 import Tree [as 别名]
# 或者: from ete3.Tree import iter_search_nodes [as 别名]
def main():
args = parse_args()
# Use the extension specified by the user if present
if args.extension:
ext = args.extension
else:
ext = '.mod.tre'
# Load the tree
t = Tree(args.tree)
# Iterate over the nodes, convert to desired value
for node in t.iter_search_nodes():
if args.decimal:
if node.support >= 1:
node.support = float(node.support * 0.01)
else:
print >> sys.stderr, 'bootstrap value in {} is < 1, \
ignoring.'.format(args.tree)
else:
if node.support <= 1:
node.support = int(node.support * 100)
else:
print >> sys.stderr, 'bootstrap value in {} is > 1, \
ignoring.'.format(args.tree)
# If the replace flag is set, replace the input file with the output file.
# Otherwise create a new file with the '.mod.tre' extension
if args.replace:
out = args.tree
else:
out = args.tree + ext
t.write(format=0, outfile=out)