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

add possibility to add modules dependencies

parent 233ca151
# Snakemake tools and workflows
This repository aims to gather all Snakemake descriptions. They all try to follow some rules in order to make them easily reusable from one workflow to another.
This repository aims to gather Snakemake descriptions. They all try to follow some rules in order to make them easily reusable from one workflow to another.
Thus, the repository is splitted in two sections:
* [__tools__](tools/): All tool descriptions. These are not meant to be used directly and need to be refered in another Snakefile
* [__subworkflows__](subworkflows/): Supposed to behave as tool descriptions, meaning that they need to be refered in another Snakefile to be used.
* [__subworkflows__](subworkflows/): Supposed to behave as tool descriptions, meaning that they need to be refered in another Snakefile to be used
* [__workflows__](workflows/): All workflows that are supposed to be usable directly
\ No newline at end of file
__metaphlan2_exec_command = config['metaphlan2'].get('exec_command', 'metaphlan2.py')
__metaphlan2_options = config['metaphlan2'].get('options', "")
__metaphlan2_threads = config['metaphlan2'].get('threads', 1)
__metaphlan2_exec_command = config.get('metaphlan2', {}).get('exec_command', 'metaphlan2.py')
__metaphlan2_modules = config.get('metaphlan2', {}).get('modules')
__metaphlan2_options = config.get('metaphlan2', {}).get('options', "")
__metaphlan2_threads = config.get('metaphlan2', {}).get('threads', 1)
rule metaphlan2:
input:
......@@ -9,9 +10,12 @@ rule metaphlan2:
__metaphlan2_output
params:
exec_command = __metaphlan2_exec_command,
modules = __metaphlan2_modules,
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}"
run:
if params.modules:
shell("module load {params.modules}")
shell("{params.exec_command} --nproc {threads} --input_type {params.input_type} {params.options} {input} {output}")
__metaphlan2_heatmap_exec_command = config['metaphlan2_heatmap'].get('exec_command', "metaphlan_hclust_heatmap.py")
__metaphlan2_heatmap_options = config['metaphlan2_heatmap'].get('options', "")
__metaphlan2_heatmap_exec_command = config.get('metaphlan2_heatmap', {}).get('exec_command', "metaphlan_hclust_heatmap.py")
__metaphlan2_heatmap_modules = config.get('metaphlan2_heatmap', {}).get('modules')
__metaphlan2_heatmap_options = config.get('metaphlan2_heatmap', {}).get('options', "")
rule heatmap:
input:
......@@ -8,6 +9,9 @@ rule heatmap:
__metaphlan2_heatmap_output
params:
exec_command = __metaphlan2_heatmap_exec_command,
modules = __metaphlan2_heatmap_modules,
options = __metaphlan2_heatmap_options
shell:
"{params.exec_command} {params.options} --in {input} --out {output}"
run:
if params.modules:
shell("module load {params.modules}")
shell("{params.exec_command} {params.options} --in {input} --out {output}")
__metaphlan2_merge_exec_command = config['metaphlan2_merge'].get('exec_command', 'merge_metaphlan_tables.py')
__metaphlan2_merge_options = config['metaphlan2_merge'].get('options', "")
__metaphlan2_merge_exec_command = config.get('metaphlan2_merge', {}).get('exec_command', 'merge_metaphlan_tables.py')
__metaphlan2_merge_modules = config.get('metaphlan2_merge', {}).get('modules')
__metaphlan2_merge_options = config.get('metaphlan2_merge', {}).get('options', "")
rule metaphlan2_merge:
input:
......@@ -8,6 +9,9 @@ rule metaphlan2_merge:
__metaphlan2_merge_output
params:
exec_command = __metaphlan2_merge_exec_command,
modules = __metaphlan2_merge_modules,
options = __metaphlan2_merge_options
shell:
"{params.exec_command} {params.options} {input} > {output}"
run:
if params.modules:
shell("module load {params.modules}")
shell("{params.exec_command} {params.options} {input} > {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