diff --git a/README.md b/README.md index 1591228591bc3b7b1357d9b222758dafbbded607..08f36d1a4a4b40929ba85c474b307699c1428356 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # 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 diff --git a/tools/metaphlan2/metaphlan2/Snakefile b/tools/metaphlan2/metaphlan2/Snakefile index f4fdec203376458894c3b9d438826dd2c9102bd3..0bee33c4aa4abc3523f2779cb42c881189356ab2 100644 --- a/tools/metaphlan2/metaphlan2/Snakefile +++ b/tools/metaphlan2/metaphlan2/Snakefile @@ -1,6 +1,7 @@ -__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}") diff --git a/tools/metaphlan2/metaphlan2_heatmap/Snakefile b/tools/metaphlan2/metaphlan2_heatmap/Snakefile index f97bb4b3749b37a36db51caa7102801b44b04e91..147e0cd3b3f06b4ff6882c405703457da507d09b 100644 --- a/tools/metaphlan2/metaphlan2_heatmap/Snakefile +++ b/tools/metaphlan2/metaphlan2_heatmap/Snakefile @@ -1,5 +1,6 @@ -__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}") diff --git a/tools/metaphlan2/metaphlan2_merge/Snakefile b/tools/metaphlan2/metaphlan2_merge/Snakefile index 4d500317d115804e8c0843de619887b470df9dc4..d9867689a7c3c8074d9293b72113af0b87864e2f 100644 --- a/tools/metaphlan2/metaphlan2_merge/Snakefile +++ b/tools/metaphlan2/metaphlan2_merge/Snakefile @@ -1,5 +1,6 @@ -__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}")