当前位置: 首页>>代码示例>>Python>>正文


Python Status.succesfully_written方法代码示例

本文整理汇总了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 = {}
开发者ID:algbioi,项目名称:docker_ppsp,代码行数:70,代码来源:train.py


注:本文中的status.Status.succesfully_written方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。