Snakefile 1.58 KB
Newer Older
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
__metaphlan3_exec_command = config.get('metaphlan3', {}).get('exec_command', 'metaphlan')
__metaphlan3_modules = config.get('metaphlan3', {}).get('modules')
__metaphlan3_input_type = config['metaphlan3'].get('input_type', 'fastq')
__metaphlan3_options = config.get('metaphlan3', {}).get('options', "")
__metaphlan3_threads = config.get('metaphlan3', {}).get('threads', 1)


rule metaphlan3_paired:
    """
    MetaPhlAn 3 can also natively handle paired-end metagenomes (but does not use the paired-end information),
    and, more generally, metagenomes stored in multiple files (but you need to specify the --bowtie2out parameter):

    $ metaphlan metagenome_1.fastq,metagenome_2.fastq --bowtie2out metagenome.bowtie2.bz2 --nproc 5
                    --input_type fastq > profiled_metagenome.txt

    """
    input:
        r1 = __metaphlan3_input_r1,
        r2 = __metaphlan3_input_r2
    output:
21
22
23
        profile = __metaphlan3_output,
        bowtie2out = __metaphlan3_output_bowtie2out,
        sams = __metaphlan3_output_sams
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
24
25
26
27
28
29
30
31
32
33
34
    params:
        exec_command = __metaphlan3_exec_command,
        modules = __metaphlan3_modules,
        input_type = __metaphlan3_input_type,
        options = __metaphlan3_options
    threads:
        __metaphlan3_threads
    run:
        command = []
        if params.modules:
            command.append("module load {params.modules}")
35
        command.append("{params.exec_command} --nproc {threads} --input_type {params.input_type} -s {output.sams} --bowtie2out {output.bowtie2out} {params.options} {input.r1},{input.r2} {output.profile}")
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
36
        shell(" && ".join(command))