def main(): option_parser, opts, args =\ parse_command_line_parameters(**script_info) params = eval(str(opts)) params['save_uc_files'] = True if opts.assignment_method == 'usearch': parallel_runner = ParallelDatabaseMapperUsearch( cluster_jobs_fp=opts.cluster_jobs_fp, jobs_to_start=opts.jobs_to_start, retain_temp_files=opts.retain_temp_files, suppress_polling=opts.suppress_polling, seconds_to_sleep=opts.seconds_to_sleep) parallel_runner(opts.input_seqs_filepath, opts.output_dir, params, job_prefix=opts.job_prefix, poll_directly=opts.poll_directly, suppress_submit_jobs=opts.suppress_submit_jobs) elif opts.assignment_method == 'blat': parallel_runner = ParallelDatabaseMapperBlat( cluster_jobs_fp=opts.cluster_jobs_fp, jobs_to_start=opts.jobs_to_start, retain_temp_files=opts.retain_temp_files, suppress_polling=opts.suppress_polling, seconds_to_sleep=opts.seconds_to_sleep) parallel_runner(opts.input_seqs_filepath, opts.output_dir, params, job_prefix=opts.job_prefix, poll_directly=opts.poll_directly, suppress_submit_jobs=opts.suppress_submit_jobs) elif opts.assignment_method == 'bwa-short': # cast max_diff to an int if it's being passed as an int if params['max_diff'] is not None and params['max_diff'] > 1.0: params['max_diff'] = int(params['max_diff']) parallel_runner = ParallelDatabaseMapperBwaShort( cluster_jobs_fp=opts.cluster_jobs_fp, jobs_to_start=opts.jobs_to_start, retain_temp_files=opts.retain_temp_files, suppress_polling=opts.suppress_polling, seconds_to_sleep=opts.seconds_to_sleep) parallel_runner(opts.input_seqs_filepath, opts.output_dir, params, job_prefix=opts.job_prefix, poll_directly=opts.poll_directly, suppress_submit_jobs=opts.suppress_submit_jobs) else: # other -- shouldn't be able to get here as a KeyError would have # been raised earlier raise ValueError( "Unknown read mapping method: %s" % opts.assignment_method)
def test_bwa_short_database_mapper_alt_params(self): """bwa_short_database_mapper functions as expected """ params = {'refseqs_fp': self.refseqs2_fp, 'max_diff': 1, 'observation_metadata_fp': None} app = ParallelDatabaseMapperBwaShort() r = app(self.inseqs2_fp, self.test_out, params, poll_directly=True, suppress_submit_jobs=False) observation_map_fp = join(self.test_out, 'observation_map.txt') self.assertTrue(exists(observation_map_fp)) observation_table_fp = join(self.test_out, 'observation_table.biom') table = parse_biom_table(open(observation_table_fp, 'U')) self.assertItemsEqual(table.SampleIds, ['s2', 's1']) self.assertItemsEqual(table.ObservationIds, ['r2', 'r3', 'r4', 'r5']) self.assertEqual(table.sum(), 5)