示例#1
0
文件: dummytree.py 项目: a1an77/ete
 def finish(self):
     node_info = self.conf["_nodeinfo"][self.nodeid]
     
     target_seqs = node_info.get("target_seqs", set())
     out_seqs = node_info.get("out_seqs", set())
     all_seqs = list(target_seqs | out_seqs)
     
     newick = "(%s, (%s));" %(all_seqs[0], ','.join(all_seqs[1:]))
     
     TreeTask.store_data(self, newick, {})
示例#2
0
文件: dummytree.py 项目: F4L2/devoirs
    def finish(self):
        node_info = self.conf["_nodeinfo"][self.nodeid]

        target_seqs = node_info.get("target_seqs", set())
        out_seqs = node_info.get("out_seqs", set())
        all_seqs = list(target_seqs | out_seqs)

        newick = "(%s, (%s));" % (all_seqs[0], ','.join(all_seqs[1:]))

        TreeTask.store_data(self, newick, {})
示例#3
0
文件: phyml.py 项目: F4L2/devoirs
    def finish(self):
        lks = []
        j = self.jobs[0]
        tree_file = os.path.join(j.jobdir,
                                 self.alg_phylip_file + "_phyml_tree.txt")
        stats_file = os.path.join(j.jobdir,
                                  self.alg_phylip_file + "_phyml_stats.txt")

        m = re.search('Log-likelihood:\s+(-?\d+\.\d+)',
                      open(stats_file).read())
        lk = float(m.groups()[0])
        stats = {"lk": lk}
        tree = PhyloTree(tree_file)
        TreeTask.store_data(self, tree.write(), stats)
示例#4
0
文件: phyml.py 项目: a1an77/ete
    def finish(self):
        lks = []
        j = self.jobs[0]
        tree_file = os.path.join(j.jobdir,
                                 self.alg_phylip_file+"_phyml_tree.txt")
        stats_file = os.path.join(j.jobdir,
                                  self.alg_phylip_file+"_phyml_stats.txt")

        m = re.search('Log-likelihood:\s+(-?\d+\.\d+)',
                      open(stats_file).read())
        lk = float(m.groups()[0])
        stats = {"lk": lk}
        tree = PhyloTree(tree_file)        
        TreeTask.store_data(self, tree.write(), stats)
示例#5
0
    def finish(self):
        #first job is the raxml tree
        def parse_alrt(match):
            dist = match.groups()[0]
            support = float(match.groups()[1]) / 100.0
            return "%g:%s" % (support, dist)

        if self.bootstrap == "alrt":
            alrt_tree_file = os.path.join(
                self.alrt_job.jobdir,
                "RAxML_fastTreeSH_Support." + self.alrt_job.args["-n"])
            raw_nw = open(alrt_tree_file).read()
            try:
                nw, nsubs = re.subn(":(\d+\.\d+)\[(\d+)\]",
                                    parse_alrt,
                                    raw_nw,
                                    flags=re.MULTILINE)
            except TypeError:
                raw_nw = raw_nw.replace("\n", "")
                nw, nsubs = re.subn(":(\d+\.\d+)\[(\d+)\]", parse_alrt, raw_nw)
            if nsubs == 0:
                log.warning("alrt values were not detected in raxml tree!")
            tree = Tree(nw)

        elif self.bootstrap == "alrt_phyml":
            alrt_tree_file = os.path.join(
                self.alrt_job.jobdir, self.alg_phylip_file + "_phyml_tree.txt")
            tree = Tree(alrt_tree_file)

        else:
            alrt_tree_file = os.path.join(
                self.bootd_job.jobdir,
                "RAxML_bipartitions." + self.bootd_job.args["-n"])
            nw = open(alrt_tree_file).read()
            tree = Tree(nw)
            tree.support = 100
            for n in tree.traverse():
                if n.support > 1:
                    n.support /= 100.
                else:
                    n.support = 0

        TreeTask.store_data(self, tree.write(), {})
示例#6
0
文件: raxml.py 项目: a1an77/ete
    def finish(self):
        #first job is the raxml tree
        def parse_alrt(match):
            dist = match.groups()[0]
            support = float(match.groups()[1])/100.0
            return "%g:%s" %(support, dist)
        
        if self.bootstrap == "alrt":
            alrt_tree_file = os.path.join(self.alrt_job.jobdir,
                                               "RAxML_fastTreeSH_Support." + self.alrt_job.args["-n"])
            raw_nw = open(alrt_tree_file).read()
            try:
                nw, nsubs = re.subn(":(\d+\.\d+)\[(\d+)\]", parse_alrt, raw_nw, flags=re.MULTILINE)
            except TypeError:
                raw_nw = raw_nw.replace("\n","")
                nw, nsubs = re.subn(":(\d+\.\d+)\[(\d+)\]", parse_alrt, raw_nw)
            if nsubs == 0:
                log.warning("alrt values were not detected in raxml tree!")
            tree = Tree(nw)                                   
            
        elif self.bootstrap == "alrt_phyml":
            alrt_tree_file = os.path.join(self.alrt_job.jobdir,
                                          self.alg_phylip_file +"_phyml_tree.txt")
            tree = Tree(alrt_tree_file)

        else:
            alrt_tree_file = os.path.join(self.bootd_job.jobdir,
                                               "RAxML_bipartitions." + self.bootd_job.args["-n"])
            nw = open(alrt_tree_file).read()
            tree = Tree(nw)
            tree.support = 100
            for n in tree.traverse():
                if n.support >1:
                    n.support /= 100.
                else:
                    n.support = 0
            
        TreeTask.store_data(self, tree.write(), {})
示例#7
0
文件: fasttree.py 项目: a1an77/ete
 def finish(self):
     job = self.jobs[-1]
     t = Tree(job.stdout_file)
     TreeTask.store_data(self, t.write(), {})
示例#8
0
文件: fasttree.py 项目: F4L2/devoirs
 def finish(self):
     job = self.jobs[-1]
     t = Tree(job.stdout_file)
     TreeTask.store_data(self, t.write(), {})