本文整理汇总了Python中cogent.LoadTree.iterTips方法的典型用法代码示例。如果您正苦于以下问题:Python LoadTree.iterTips方法的具体用法?Python LoadTree.iterTips怎么用?Python LoadTree.iterTips使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cogent.LoadTree
的用法示例。
在下文中一共展示了LoadTree.iterTips方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from cogent import LoadTree [as 别名]
# 或者: from cogent.LoadTree import iterTips [as 别名]
def main():
option_parser, opts, args =\
parse_command_line_parameters(**script_info)
start_time = datetime.now()
t = LoadTree(opts.input_tree)
translation_dict = {}
for i,tip in enumerate(t.iterTips()):
translation_dict[tip.Name] = i
single_rate = False
#Generate commands telling BayesTraits which nodes to reconstruct
bayestraits_commands = make_bayestraits_script(t,translation_dict,comments=False,single_rate=single_rate)
#TODO: make this dynamic
#Temporarily assuming there is a nexus file available
nexus_fp = opts.input_tree.rsplit(".",1)[0] +".nexus"
command_fp = "./bayestraits_commands.txt"
path_to_bayestraits = "../"
outfile = "./bayestrait_reconstruction.trait_table"
command_file = open(command_fp,"w+")
command_file.writelines(bayestraits_commands)
command_file.close()
command_file = open(command_fp,"U")
bayestraits=BayesTraits()
bayestraits_result = bayestraits(data=(nexus_fp,opts.input_trait_data,command_fp))
#print "StdOut:",result["StdOut"].read()
print "StdErr:",bayestraits_result["StdErr"].read()
print "Return code:",bayestraits_result["ExitStatus"]
results = parse_reconstruction_output(bayestraits_result['StdOut'].readlines())
#print "Reconstructions:",results
#Reconstruction results
f = open(outfile,"w+")
f.writelines(results)
f.close()
end_time = datetime.now()
print "Start time:", start_time
print "End time:",end_time
print "Time to reconstruct:", end_time - start_time
bayestraits_result.cleanUp()