def dada2_full(config, sample_set_name, learn_errors_preset, core_algo_preset, merged_preset, nonchim_preset, **kwargs): # check if database initialized if config['config'].get('dada2-silva_nr_v132', None) is None: click.secho('Silva database not initialized!', fg='red') click.echo('run ' + click.style('assnake init dada2-silva-db', bg='blue') + ' and follow instructions') exit() # load sample set sample_set, sample_set_name_gen = generic_command_individual_samples(config, **kwargs) if sample_set_name == '': sample_set_name = sample_set_name_gen learn_errors_result = Result.get_result_by_name('dada2-learn-errors') learn_errors_preset = learn_errors_result.preset_manager.find_preset_by_name(learn_errors_preset) if learn_errors_preset is not None: learn_errors_preset = learn_errors_preset['full_name'] else: click.secho('NO SUCH PRESET', fg='red') exit() # Prepare sample set file res_list = prepare_sample_set_tsv_and_get_results(sample_set, sample_set_name, wc_config = config['wc_config'], learn_errors_preset = learn_errors_preset, core_algo_preset = core_algo_preset, merged_preset = merged_preset, nonchim_preset = nonchim_preset) config['requests'] += res_list
def map_bowtie2(config, **kwargs): wc_str = '{fs_prefix}/{df}/mapped/bowtie2__{params}__{version}/{reference}/{df_sample}/{preproc}/{df_sample}.sam' sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) config['requests'] += generate_result_list(sample_set, wc_str, **kwargs) config['requested_results'] += [{ 'result': 'map-bowtie2', 'sample_set': sample_set }]
def centrifuge_invocation(config, **kwargs): wc_str = '{fs_prefix}/{df}/taxa/centr__{params}__v1.0.4_beta/{database}/{df_sample}/{preproc}/{df_sample}_report.tsv' sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) config['requests'] += generate_result_list(sample_set, wc_str, **kwargs) config['requested_results'] += [{ 'result': 'centrifuge', 'sample_set': sample_set }]
def mp2_invocation(config, **kwargs): wc_str = '{fs_prefix}/{df}/taxa/mp2__{params}__v3.0/{database}/{df_sample}/{preproc}/{df_sample}.mp2' sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) config['requests'] += generate_result_list(sample_set, wc_str, **kwargs) config['requested_results'] += [{ 'result': 'metaphlan2', 'sample_set': sample_set }]
def mp2_rare_invocation(config, **kwargs): sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) props = ['0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9'] for p in props: wc_str = '{{fs_prefix}}/{{df}}/taxa/mp2__{{params}}__v2.96.1/{{database}}/{{df_sample}}/{{preproc}}/{{df_sample}}_sbsmpl{prop}.mp2'.format( prop=p) config['requests'] += generate_result_list(sample_set, wc_str, **kwargs) config['requested_results'] += [{ 'result': 'metaphlan2', 'sample_set': sample_set }]
def bbtools_tadpole_invocation(config, params, **kwargs): wc_str = '{fs_prefix}/{df}/reads/{preproc}__bbtdpl_{params}/{df_sample}_R1.fastq.gz' kwargs.update({'params': params}) if (kwargs['df'] is None): previous_requested_result = config['requested_results'][-1] if previous_requested_result['preprocessing']: sample_set = previous_requested_result['sample_set'] sample_set['preproc'] = sample_set['preproc']+'__'+previous_requested_result['preprocessing_addition'] else: sample_set, sample_set_name = generic_command_individual_samples(config, **kwargs) config['requests'] += generate_result_list(sample_set, wc_str, **kwargs) config['requested_results'] += [{'result': 'bbtools-tadpole', 'sample_set': sample_set, 'preprocessing': True}]
def result_invocation(config, **kwargs): # kwargs.update({'params': params}) if 'preset' in kwargs.keys( ) and self.preset_manager is not None: preset = self.preset_manager.find_preset_by_name( kwargs['preset']) if preset is not None: kwargs['preset'] = preset['full_name'] else: click.secho('NO SUCH PRESET', fg='red') exit() sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) config['requests'] += generate_result_list( sample_set, self.result_wc, **kwargs)
def map_bwa(config, reference, params, version, **kwargs): sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) res_list = [] for s in sample_set.samples_pd.to_dict(orient='records'): preprocessing = s['preproc'] res_list.append( '{fs_prefix}/{df}/mapped/bwa__{version}__{params}/{reference}/{sample}/{preproc}/{sample}.bam' .format(fs_prefix=s['fs_prefix'].rstrip('\/'), df=s['df'], preproc=preprocessing, sample=s['fs_name'], reference=reference, params=params, version=version)) config['requests'] += res_list
def feature_counts(config, reference, **kwargs): sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) res_list = [] for s in sample_set.to_dict(orient='records'): preprocessing = s['preproc'] res_list.append( '{fs_prefix}/{df}/mapped/{mapper}__{version}__{params}/{reference}/{df_sample}/{preproc}/{df_sample}_feature_counts.tsv' .format(fs_prefix=s['fs_prefix'].rstrip('\/'), df=s['df'], preproc=preprocessing, df_sample=s['df_sample'], reference=reference, mapper='bwa', params='def', version='0.7.17')) print(res_list) config['requests'] += res_list
def bbtools_tadpole_invocation(config, params, **kwargs): wc_str = '{fs_prefix}/{df}/reads/{preproc}__bbtsbsmpl_{params}/{df_sample}_R1.fastq.gz' kwargs.update({'params': params}) sample_set, sample_set_name = generic_command_individual_samples(config, **kwargs) config['requests'] += generate_result_list(sample_set, wc_str, **kwargs)
def result_invocation(config, strand, **kwargs): sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) config['requests'] += generate_result_list(sample_set, self.result_wc, strand=strand)
def seqtk_subsample_invocation(config, **kwargs): # print(config['wc_config']) wc_str = '{fs_prefix}/{df}/reads/{preproc}__seqtk_sbsmpl/{df_sample}_R1.fastq.gz' sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) config['requests'] += generate_result_list(sample_set, wc_str, **kwargs)
def rmhumbbmap_invocation(config, **kwargs): wc_str = '{fs_prefix}/{df}/reads/{preproc}__rmhum_bbmap/{df_sample}_R1.fastq.gz' sample_set, sample_set_name = generic_command_individual_samples( config, **kwargs) config['requests'] += generate_result_list(sample_set, wc_str, **kwargs)