Commit 7f8a53c3 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

add rule and example for metaphlan2

parent d6cfbd40
input_dir: data
metaphlan2:
threads: 1
input_type: fastq
options: "COMMAND LINE OPTIONS"
exec_command: metaphlan2.py
__metaphlan2_exec_command = config['metaphlan2'].get('exec_command', 'metaphlan2.py')
__metaphlan2_options = config['metaphlan2'].get('options', "")
__metaphlan2_threads = config['metaphlan2'].get('threads', 1)
rule metaphlan2:
input:
__metaphlan2_input
output:
__metaphlan2_output
params:
exec_command = __metaphlan2_exec_command,
input_type = __metaphlan2_input_type,
options = __metaphlan2_options
threads:
__metaphlan2_threads
shell:
"{params.exec_command} --nproc {threads} --input_type {params.input_type} {params.options} {input} {output}"
"""
This example would be used as followed:
$ snakemake --snakefile metaphlan2.rules output/s01.txt
It requires the presence of data/s01.fastq.gz to work based on config file
"""
configfile: "config.yaml"
__input_dir = config['input_dir']
__main_output_dir = config.get('output_dir', 'output')
# ---- Metaphlan2
__metaphlan2_output_dir = __main_output_dir + "/metaphlan2"
__metaphlan2_input_type = config['metaphlan2'].get('input_type', 'fastq')
__metaphlan2_input = "{dir}/{sample}.{ext}".format(dir=__input_dir,
sample="{sample}",
ext=__metaphlan2_input_type + ".gz")
__metaphlan2_output = "{dir}/{sample}.txt".format(dir=__metaphlan2_output_dir,
sample="{sample}")
include: "metaphlan2.rules"
rule all:
input:
__metaphlan2_output
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment