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')) input_fn = path.join(directory, path.basename(config['transcriptome'])) name_map_fn = input_fn + '.dammit.namemap.csv' handler.register_task('rename-transcriptome', get_rename_transcriptome_task( path.abspath(config['transcriptome']), input_fn, name_map_fn, config['name'], config['no_rename'] ), files={'transcriptome': input_fn, 'name_map': name_map_fn}) return handler
def get_handler(config): '''Build the TaskHandler for the database prep pipeline. 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 database dictionary from `databases.json`. Returns: handler.TaskHandler: A constructed TaskHandler. ''' logger = logging.getLogger('DatabaseHandler') logger.debug('get_handler') handler = TaskHandler(config['database_dir'], logger, db='databases', backend=config['doit_backend'], verbosity=config['verbosity'], n_threads=config['n_threads']) return handler