File: tcoffee.py

package info (click to toggle)
python-ete3 3.1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,152 kB
  • sloc: python: 52,375; javascript: 12,959; xml: 4,903; ansic: 69; sql: 65; makefile: 26; sh: 7
file content (42 lines) | stat: -rw-r--r-- 1,526 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from __future__ import absolute_import
import os
import logging
log = logging.getLogger("main")

from ..master_task import AlgTask
from ..master_job import Job
from ..utils import (SeqGroup, OrderedDict, pjoin,
                     GLOBALS, DATATYPES)
from .. import db

__all__ = ["TCoffee"]

class TCoffee(AlgTask):
    def __init__(self, nodeid, multiseq_file, seqtype, conf, confname):
        self.confname = confname
        self.conf = conf
        # Initialize task
        task_name =   "TCoffee(-%s)" %conf["-mode"] if "-mode" in conf else "TCoffee"
        AlgTask.__init__(self, nodeid, "alg", task_name,
                         OrderedDict(), self.conf[self.confname])
        self.seqtype = seqtype
        self.multiseq_file = multiseq_file
        self.size = conf["_nodeinfo"][nodeid].get("size", 0)
        self.init()

    def load_jobs(self):
        args = OrderedDict()
        args[""] = pjoin(GLOBALS["input_dir"], self.multiseq_file)
        for k, v in self.args.items():
            args[k] = v
        args["-outfile"] = "mcoffee.fasta" 
        job = Job(self.conf["app"]["tcoffee"], args, parent_ids=[self.nodeid])
        job.add_input_file(self.multiseq_file)
        job.cores = self.conf["threading"]["tcoffee"]
        self.jobs.append(job)
        
    def finish(self):
        alg = SeqGroup(os.path.join(self.jobs[0].jobdir, "mcoffee.fasta"))
        fasta = alg.write(format="fasta")
        phylip = alg.write(format="iphylip_relaxed")
        AlgTask.store_data(self, fasta, phylip)