本文整理汇总了Python中status.Status.succesfully_written方法的典型用法代码示例。如果您正苦于以下问题:Python Status.succesfully_written方法的具体用法?Python Status.succesfully_written怎么用?Python Status.succesfully_written使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类status.Status
的用法示例。
在下文中一共展示了Status.succesfully_written方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from status import Status [as 别名]
# 或者: from status.Status import succesfully_written [as 别名]
#.........这里部分代码省略.........
if self.config.settings["tree_file"] is None or self.config.settings["tree_file"] == "":
# create clade list (own method?)
descandents = {}
for organism in self.organisms:
for rank in self.config.settings["taxonomy_ranks"]:
parent = self.sqlite_taxonomy.parent_at_rank(organism, rank)
print('!!! Call: parent = self.sqlite_taxonomy.parent_at_rank(organism, rank) !!!')
if parent in descandents:
descandents[parent] += 1
else:
descandents[parent] = 1
for parent in descandents.keys():
if parent is None or parent == "":
continue
if descandents[parent] >= self.config.settings["n_min_genomes_generic"]:
self.nodes.append(parent)
else:
# read the tree_string
nodes_tmp = utils.get_lines(self.config.settings["tree_file"])
for n in nodes_tmp:
if n != "" and n is not None:
self.nodes.append(n.rstrip("\n"))
tree_string = self.nodes[0]
# check if the tree is a newick string or a node list
t_file = os.path.join(self.config.settings["project_dir"], "tree.newick")
if ";" not in self.nodes[0] and len(self.nodes) >= 1:
my_log.debug("Generating tree from the clades list ({} clades)....".format(str(len(self.nodes))))
clades_file = os.path.join(self.config.settings["project_dir"], "clades.txt")
utils.list_to_file(self.nodes, clades_file)
if self.stat is not None:
self.stat.add_written_file(clades_file)
self.stat.succesfully_written(clades_file)
# run script to create tree
obj = ncbi2newick.Ncbi2Newick(self.config.ncbi_tax_db, logged=True)
obj.tree_from_nodes(clades_file)
obj.tree_to_file(t_file)
obj.close()
else:
my_log.debug("Copying tree to the project directory...")
fw = open(t_file, "w")
if self.stat is not None:
self.stat.add_written_file(t_file)
fw.write(tree_string)
if self.stat is not None:
self.succesfully_written(t_file)
fw.close()
# change tree_file to the tree in the project directory
# get back the tree_string and nodes, this is necessary for further processing
self.tree_file = os.path.join(self.config.settings["project_dir"], "tree.newick")
fr = open(self.tree_file, "r")
tree_string = fr.readline().rstrip()
fr.close()
if tree_string == "":
my_log.critical("First line is empty in the newick file: {}".format(self.tree_file))
sys.exit(1)
self.nodes = ncbi2newick.get_nodes_from_newick(self.tree_file)
def map_genomes_on_tree(self):
my_log = logging.getLogger('train:map_genomes')
self.organism_tree_map = {}