Пример #1
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(), {})
Пример #2
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(), {})
Пример #3
0
 def finish(self):
     job = self.jobs[-1]
     t = Tree(job.stdout_file)
     TreeTask.store_data(self, t.write(), {})
Пример #4
0
 def finish(self):
     job = self.jobs[-1]
     t = Tree(job.stdout_file)
     TreeTask.store_data(self, t.write(), {})