Skip to content
Snippets Groups Projects

Metaphlan2 to use paired-end reads

Merged Kenzo-Hugo Hillion requested to merge 14-metaphlan2-paired into master
14 files
+ 219
83
Compare changes
  • Side-by-side
  • Inline
Files
14
+ 35
0
__metaphlan2_exec_command = config.get('metaphlan2', {}).get('exec_command', 'metaphlan2.py')
__metaphlan2_modules = config.get('metaphlan2', {}).get('modules')
__metaphlan2_input_type = config['metaphlan2'].get('input_type', 'fastq')
__metaphlan2_options = config.get('metaphlan2', {}).get('options', "")
__metaphlan2_threads = config.get('metaphlan2', {}).get('threads', 1)
rule metaphlan2_paired:
"""
MetaPhlAn 2 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):
$ metaphlan2.py metagenome_1.fastq,metagenome_2.fastq --bowtie2out metagenome.bowtie2.bz2 --nproc 5
--input_type fastq > profiled_metagenome.txt
"""
input:
r1 = __metaphlan2_input_r1,
r2 = __metaphlan2_input_r2
output:
__metaphlan2_output
params:
exec_command = __metaphlan2_exec_command,
modules = __metaphlan2_modules,
input_type = __metaphlan2_input_type,
bowtie2out = "{output_dir}/{sample}.bowtie2.bz2".format(output_dir=__metaphlan2_output_dir, sample="{sample}"),
options = __metaphlan2_options
threads:
__metaphlan2_threads
run:
command = []
if params.modules:
command.append("module load {params.modules}")
command.append("{params.exec_command} --nproc {threads} --input_type {params.input_type} --bowtie2out {params.bowtie2out} {params.options} {input.r1},{input.r2} {output}")
shell(" && ".join(command))
Loading