Example #1
0
def get_handler(config, databases):
    '''Build the TaskHandler for the annotation pipelines. The
    handler will not have registered tasks when returned.

    Args:
        config (dict): Config dictionary, which contains the command
            line arguments and the entries from the config file.
        databases (dict): The dictionary of files from a database
            TaskHandler.

    Returns:
        handler.TaskHandler: A constructed TaskHandler.
    '''

    logger = logging.getLogger('AnnotateHandler')

    if config['output_dir'] is None:
        out_dir = path.basename(config['transcriptome'] + '.dammit')
    else:
        out_dir = config['output_dir']
    directory = path.abspath(out_dir)

    handler = TaskHandler(directory,
                          logger,
                          db='annotate',
                          backend=config['doit_backend'],
                          verbosity=config['verbosity'],
                          profile=config['profile'])
    log.start_logging(path.join(directory, 'dammit.log'))

    txome_fn = path.join(directory, path.basename(config['transcriptome']))

    if not config['no_rename']:
        name_map_fn = txome_fn + '.dammit.namemap.csv'
        handler.register_task('rename-transcriptome',
                              get_rename_transcriptome_task(
                                  path.abspath(config['transcriptome']),
                                  txome_fn, name_map_fn, config['name']),
                              files={
                                  'transcriptome': txome_fn,
                                  'name_map': name_map_fn
                              })
    else:
        handler.register_task('copy-transcriptome',
                              get_copy_file_task(
                                  path.abspath(config['transcriptome']),
                                  txome_fn),
                              files={'transcriptome': txome_fn})

    return handler
Example #2
0
    def handle_databases(self):
        log.start_logging()
        print(ui.header('submodule: databases', level=2))

        handler = databases.get_handler(self.config_d)
        if self.args.quick:
            databases.build_quick_pipeline(handler, self.config_d,
                                           self.databases_d)
        else:
            databases.build_default_pipeline(handler,
                                             self.config_d,
                                             self.databases_d,
                                             with_uniref=self.args.full,
                                             with_nr=self.args.nr)
        if self.args.install:
            return databases.install(handler)
        else:
            databases.check_or_fail(handler)
Example #3
0
    def handle_annotate(self):
        log.start_logging()
        print(ui.header('submodule: annotate', level=2))

        db_handler = databases.get_handler(self.config_d)

        if self.args.quick:
            databases.build_quick_pipeline(db_handler, self.config_d,
                                           self.databases_d)
        else:
            databases.build_default_pipeline(db_handler,
                                             self.config_d,
                                             self.databases_d,
                                             with_uniref=self.args.full,
                                             with_nr=self.args.nr)
        if self.config_d['force'] is True:
            utd_msg = '*All database tasks up-to-date.*'
            ood_msg = '*Some database tasks out-of-date; '\
                      'FORCE is True, ignoring!'
            uptodate, statuses = db_handler.print_statuses(
                uptodate_msg=utd_msg, outofdate_msg=ood_msg)
        else:
            databases.check_or_fail(db_handler)

        annotate_handler = annotate.get_handler(self.config_d,
                                                db_handler.files)
        if self.args.quick:
            build_quick_pipeline(annotate_handler, self.config_d,
                                 db_handler.files)
        elif self.args.full:
            build_full_pipeline(annotate_handler, self.config_d,
                                db_handler.files)
        elif self.args.nr:
            build_nr_pipeline(annotate_handler, self.config_d,
                              db_handler.files)
        else:
            build_default_pipeline(annotate_handler, self.config_d,
                                   db_handler.files)
        return annotate.run_annotation(annotate_handler)
Example #4
0
import traceback
import shutil
import stat
import sys
import warnings as _warnings
from pkg_resources import Requirement, resource_filename, ResolutionError
from tempfile import mkdtemp

from doit.cmd_base import TaskLoader
from doit.doit_cmd import DoitMain
from doit.dependency import Dependency, DbmDB

from pytest import fixture

from dammit import log
log.start_logging(test=True)
logger = logging.getLogger('Tests')
'''
BATCH EFFECTS -- The Notorious A.T.G.
-------------------------------------

Shit your 'scripts ain't differential -
they're preferential
(-ly selected!)
from you read seq
to your DEseq
your biases are your analyses fallacies
your matrices
are make-believe
your shallow e-values swallowing your logic and your counts bouncin' --
you got BATCH EFFECTS