Skip to content
Snippets Groups Projects
Commit bc228c62 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion :recycle:
Browse files

add possibility to add modules dependencies

parent 233ca151
No related branches found
No related tags found
No related merge requests found
# Snakemake tools and workflows # 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: 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 * [__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 * [__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_exec_command = config.get('metaphlan2', {}).get('exec_command', 'metaphlan2.py')
__metaphlan2_options = config['metaphlan2'].get('options', "") __metaphlan2_modules = config.get('metaphlan2', {}).get('modules')
__metaphlan2_threads = config['metaphlan2'].get('threads', 1) __metaphlan2_options = config.get('metaphlan2', {}).get('options', "")
__metaphlan2_threads = config.get('metaphlan2', {}).get('threads', 1)
rule metaphlan2: rule metaphlan2:
input: input:
...@@ -9,9 +10,12 @@ rule metaphlan2: ...@@ -9,9 +10,12 @@ rule metaphlan2:
__metaphlan2_output __metaphlan2_output
params: params:
exec_command = __metaphlan2_exec_command, exec_command = __metaphlan2_exec_command,
modules = __metaphlan2_modules,
input_type = __metaphlan2_input_type, input_type = __metaphlan2_input_type,
options = __metaphlan2_options options = __metaphlan2_options
threads: threads:
__metaphlan2_threads __metaphlan2_threads
shell: run:
"{params.exec_command} --nproc {threads} --input_type {params.input_type} {params.options} {input} {output}" 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_exec_command = config.get('metaphlan2_heatmap', {}).get('exec_command', "metaphlan_hclust_heatmap.py")
__metaphlan2_heatmap_options = config['metaphlan2_heatmap'].get('options', "") __metaphlan2_heatmap_modules = config.get('metaphlan2_heatmap', {}).get('modules')
__metaphlan2_heatmap_options = config.get('metaphlan2_heatmap', {}).get('options', "")
rule heatmap: rule heatmap:
input: input:
...@@ -8,6 +9,9 @@ rule heatmap: ...@@ -8,6 +9,9 @@ rule heatmap:
__metaphlan2_heatmap_output __metaphlan2_heatmap_output
params: params:
exec_command = __metaphlan2_heatmap_exec_command, exec_command = __metaphlan2_heatmap_exec_command,
modules = __metaphlan2_heatmap_modules,
options = __metaphlan2_heatmap_options options = __metaphlan2_heatmap_options
shell: run:
"{params.exec_command} {params.options} --in {input} --out {output}" 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_exec_command = config.get('metaphlan2_merge', {}).get('exec_command', 'merge_metaphlan_tables.py')
__metaphlan2_merge_options = config['metaphlan2_merge'].get('options', "") __metaphlan2_merge_modules = config.get('metaphlan2_merge', {}).get('modules')
__metaphlan2_merge_options = config.get('metaphlan2_merge', {}).get('options', "")
rule metaphlan2_merge: rule metaphlan2_merge:
input: input:
...@@ -8,6 +9,9 @@ rule metaphlan2_merge: ...@@ -8,6 +9,9 @@ rule metaphlan2_merge:
__metaphlan2_merge_output __metaphlan2_merge_output
params: params:
exec_command = __metaphlan2_merge_exec_command, exec_command = __metaphlan2_merge_exec_command,
modules = __metaphlan2_merge_modules,
options = __metaphlan2_merge_options options = __metaphlan2_merge_options
shell: run:
"{params.exec_command} {params.options} {input} > {output}" if params.modules:
shell("module load {params.modules}")
shell("{params.exec_command} {params.options} {input} > {output}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment