Esempio n. 1
0
class PastaTeam (object):
    '''A blob for holding the appropriate merger, alignment, and tree_estimator tools
    as well as the TempFS object that keeps track of the directories that have
    been created by this process.

    '''
    def __init__(self, config):
        """Uses a configuration object `cfg` to get reference for the tools the user
        has chosen.
        """
        try:
            max_mem_mb = config.sate.max_mem_mb
            self._temp_fs = TempFS()
            self.aligner = config.create_aligner(temp_fs=self._temp_fs)
            self.aligner.max_mem_mb = max_mem_mb
            self.hmmeralign = config.create_aligner(temp_fs=self._temp_fs, name = "hmmeralign")
            self.merger = config.create_merger(temp_fs=self._temp_fs)
            self.merger.max_mem_mb = max_mem_mb
            self.tree_estimator = config.create_tree_estimator(temp_fs=self._temp_fs)
            self.raxml_tree_estimator = config.create_tree_estimator(name='Raxml', temp_fs=self._temp_fs)
            # self.subsetalignmentjobs=[] #needed for interuptable job
            self.subsets = {} # needed for pastamerger
            self.alignmentjobs = [] # needed for pastamerger

            self.interruptible=False
            self.config = config
        except AttributeError:
            raise
            raise ValueError("config cannot be None unless all of the tools are passed in.")
    def get_temp_fs(self):
        return self._temp_fs
    temp_fs = property(get_temp_fs)

    def change_aligner_to_custom(self):
        self.aligner=self.config.create_aligner(temp_fs=self._temp_fs,custom=True)

    def make_picklable(self):
        self._temp_fs.make_picklable()
        self.hmmeralign.make_picklable()

    def make_unpickled(self):
        self._temp_fs.make_unpickled()
        self.hmmeralign.make_unpickled()