Example #1
0
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
Example #2
0
def show_installed_results():
    """
    Show available results in your installation
    """

    results = Result.get_all_results_as_list()
    click.echo(results)
Example #3
0
import os
from assnake.core.result import Result

result = Result.from_location(name='multiqc',
                              description='Multiqc report from FastQC',
                              result_type='quality_profile',
                              input_type='illumina_strand_file_set',
                              location=os.path.dirname(
                                  os.path.abspath(__file__)))
import os
from assnake.core.result import Result

result = Result.from_location(name='cutadapt',
                              description='CUTADAPT',
                              result_type = 'preprocessing',
                              input_type='illumina_sample',
                              with_presets=False,
                              location=os.path.dirname(os.path.abspath(__file__)))
Example #5
0
import click, os
from assnake.core.result import Result

result = Result.from_location(name='megahit',
                              description='Ultra-fast and memory-efficient NGS assembler',
                              result_type='assembly',
                              input_type='illumina_sample_set',
                              with_presets=True,
                              additional_inputs=[
                                  click.option('--min-len', '-l', help='Minimum length of contigs', default=1000),
                                  click.option('--overwrite', is_flag=True, help='Overwrite existing sample_set.tsv files', default=False)
                              ],
                              location=os.path.dirname(os.path.abspath(__file__))
                              )
Example #6
0
import click, glob, os
import assnake.api.loaders
import assnake
from assnake.cli.cli_utils import sample_set_construction_options, add_options, generic_command_individual_samples,\
    generate_result_list, generic_command_dict_of_sample_sets, prepare_sample_set_tsv_and_get_results
from assnake.core.result import Result

@click.command('anvio-gen-db', short_help='Calculate completeness and contamination metrics for your MAGs')
@add_options(sample_set_construction_options)

@click.option('--min-len','-l', help='Minimum length of contigs', default=1000)
@click.option('--overwrite', is_flag=True, help='Overwrite existing sample_set.tsv files', default=False)

@click.pass_obj

def anvio_gen_db_invocation(config, min_len,overwrite, **kwargs):
    # load sample sets     
    sample_sets = generic_command_dict_of_sample_sets(config,   **kwargs)

    sample_set_dir_wc = '{fs_prefix}/{df}/assembly/{sample_set}/'
    result_wc = '{fs_prefix}/{df}/assembly/{sample_set}/megahit__v1.2.9__def/final_contigs__{mod}.db'
    res_list = prepare_sample_set_tsv_and_get_results(sample_set_dir_wc, result_wc, df = kwargs['df'], sample_sets = sample_sets, mod = min_len, overwrite = overwrite)

    config['requests'] += res_list


this_dir = os.path.dirname(os.path.abspath(__file__))
result = Result.from_location(name = 'anvio-gen-db', location = this_dir, input_type = 'illumina_sample_set', additional_inputs = None, invocation_command = anvio_gen_db_invocation)
Example #7
0
import os
from assnake.core.result import Result

result = Result.from_location(name='trimmomatic',
                              description='Quality based trimming',
                              result_type='preprocessing',
                              input_type='illumina_sample',
                              with_presets=True,
                              static_files_dir_name='adapters',
                              location=os.path.dirname(
                                  os.path.abspath(__file__)))
Example #8
0
import click, os
from assnake.core.result import Result

result = Result.from_location(name='bwa-mem',
                              description='Map your samples on reference using BWA MEM',
                              result_type='aligner',
                              location=os.path.dirname(os.path.abspath(__file__)), 
                              input_type='illumina_sample', 
                              additional_inputs=[
                                  click.option('--reference', help='Reference to use', required=True, type=click.STRING),
                                  click.option('--params', help='Parameters to use', default='def', type=click.STRING ),
                                  click.option('--version', help='Version of BWA', default='0.7.17', type=click.STRING )
                              ])
Example #9
0
import os
from assnake.core.result import Result

result = Result.from_location(
    name='dada2-merge',
    description='Merge strands of your samples with DADA2',
    result_type='dada2',
    input_type='illumina_sample_set',
    with_presets=True,
    preset_file_format='yaml',
    location=os.path.dirname(os.path.abspath(__file__)))
Example #10
0
import os
from assnake.core.result import Result

result = Result.from_location(
    name='dada2-learn-errors',
    description='Learn error profile of provided samples',
    result_type='dada2',
    input_type='illumina_sample_set',
    with_presets=True,
    preset_file_format='yaml',
    location=os.path.dirname(os.path.abspath(__file__)))
Example #11
0
import os
from assnake.core.result import Result

result = Result.from_location(name='count',
                              description='Count number of reads and basepairs in fastq file',
                              result_type = 'quality_profile',
                              input_type='illumina_strand_file',
                              location=os.path.dirname(os.path.abspath(__file__))
                              ) 
Example #12
0
import click, os
from assnake.core.result import Result

result = Result.from_location(name='salmon',
                              description='Quasi transcript aligner',
                              result_type='aligner',
                              location=os.path.dirname(os.path.abspath(__file__)), 
                              input_type='illumina_sample', 
                              additional_inputs=[
                                  click.option('--reference', help='Reference to use', required=True, type=click.STRING)
                              ])
Example #13
0
import click, os
from assnake.core.result import Result

result = Result.from_location(
    name='metaphlan',
    description='Taxonomic annotation based on marker genes with MetaPhlan 3',
    result_type='taxonomy',
    location=os.path.dirname(os.path.abspath(__file__)),
    input_type='illumina_sample',
    additional_inputs=[
        click.option('--preset',
                     help='Preset to use. Available presets: ',
                     default='def'),
        click.option('--version',
                     help='Version of metaphlan to use',
                     default='v3.0.0'),
        click.option('--database',
                     help='Metaphlan database to use',
                     required=True,
                     default='v30_CHOCOPhlAn_201901')
    ])
Example #14
0
import click, os
from assnake.core.result import Result

result = Result.from_location(
    name='deblur',
    description='Ultra-fast and memory-efficient NGS assembler',
    result_type='assembly',
    input_type='illumina_sample_set',
    with_presets=True,
    location=os.path.dirname(os.path.abspath(__file__)))
Example #15
0
import click, glob, os
from assnake.core.sample_set import generic_command_individual_samples, generate_result_list
from assnake.core.command_builder import sample_set_construction_options, add_options
from assnake.core.result import Result


@click.command('seqtk-subsample', short_help='Subsample your reads')
@add_options(sample_set_construction_options)
@click.pass_obj
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)


this_dir = os.path.dirname(os.path.abspath(__file__))
result = Result.from_location(name='seqtk-subsample',
                              location=this_dir,
                              input_type='illumina_sample',
                              additional_inputs=None,
                              invocation_command=seqtk_subsample_invocation)
Example #16
0
import click, glob, os
from assnake.core.sample_set import generic_command_individual_samples, generate_result_list
from assnake.core.command_builder import sample_set_construction_options, add_options
from assnake.core.result import Result


@click.command('remove-human-bbmap', short_help='Quality based trimming')
@add_options(sample_set_construction_options)
@click.pass_obj
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)


this_dir = os.path.dirname(os.path.abspath(__file__))
result = Result.from_location(name='remove-human-bbmap',
                              location=this_dir,
                              input_type='illumina_sample',
                              additional_inputs=None,
                              invocation_command=rmhumbbmap_invocation)
Example #17
0
import os
from assnake.core.result import Result

result = Result.from_location(
    name='vsearch-merge-pairs',
    description='Merge paired-end reads into one sequence with Vsearch',
    result_type='preprocessing',
    input_type='illumina_sample',
    with_presets=True,
    preset_file_format='yaml',
    location=os.path.dirname(os.path.abspath(__file__)))
import click, glob, os
from assnake.core.sample_set import generic_command_individual_samples, generate_result_list
from assnake.core.command_builder import sample_set_construction_options, add_options
from assnake.core.result import Result

this_dir = os.path.dirname(os.path.abspath(__file__))
result = Result.from_location(
    name='remove-human-bbmap',
    location=this_dir,
    description='Human DNA removal',
    result_type='preprocessing',
    input_type='illumina_sample',
)
Example #19
0
from assnake.core.sample_set import generic_command_individual_samples, generate_result_list
from assnake.core.command_builder import sample_set_construction_options, add_options
from assnake.core.result import Result
parameters = []

@click.command('bbtools-tadpole', short_help='Tadpole')
@click.option('--params', help='Parameters id to use. Available parameter sets: ' + str(parameters), required=False, default = 'def')
@add_options(sample_set_construction_options)
@click.pass_obj
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}]


this_dir = os.path.dirname(os.path.abspath(__file__))
result = Result.from_location(name = 'bbtools_tadpole', location = this_dir, input_type = 'illumina_sample', additional_inputs = None, invocation_command = bbtools_tadpole_invocation)


import os
from assnake.core.result import Result

result = Result.from_location(
    name='fastqc',
    description='Quality control checks on raw sequence data',
    result_type='quality_profile',
    input_type='illumina_strand_file',
    location=os.path.dirname(os.path.abspath(__file__)))