From ba3a4101ec47879755872623d083b4d374d43ba2 Mon Sep 17 00:00:00 2001 From: kehillio <kenzo-hugo.hillion1@pasteur.fr> Date: Thu, 16 May 2019 17:12:00 +0200 Subject: [PATCH] add module dependency for graphlan --- tools/graphlan/export2graphlan/Snakefile | 14 ++++++++++---- tools/graphlan/graphlan/Snakefile | 14 ++++++++++---- tools/graphlan/graphlan_annotate/Snakefile | 14 ++++++++++---- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/tools/graphlan/export2graphlan/Snakefile b/tools/graphlan/export2graphlan/Snakefile index 448fcf0..05b030c 100644 --- a/tools/graphlan/export2graphlan/Snakefile +++ b/tools/graphlan/export2graphlan/Snakefile @@ -1,5 +1,6 @@ -__export2graphlan_exec_command = config['export2graphlan'].get('exec_command', 'export2graphlan.py') -__export2graphlan_options = config['export2graphlan'].get('options', "") +__export2graphlan_exec_command = config.get('export2graphlan', {}).get('exec_command', 'export2graphlan.py') +__export2graphlan_modules = config.get('export2graphlan', {}).get('modules') +__export2graphlan_options = config.get('export2graphlan', {}).get('options', "") rule export2graphlan: input: @@ -9,6 +10,11 @@ rule export2graphlan: annot = __export2graphlan_output_annotation params: exec_command = __export2graphlan_exec_command, + modules = __export2graphlan_modules, options = __export2graphlan_options - shell: - "{params.exec_command} {params.options} -i {input} --tree {output.tree} --annotation {output.annot}" + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} {params.options} -i {input} --tree {output.tree} --annotation {output.annot}") + shell(" && ".join(command)) \ No newline at end of file diff --git a/tools/graphlan/graphlan/Snakefile b/tools/graphlan/graphlan/Snakefile index 62f7a23..6617e1b 100644 --- a/tools/graphlan/graphlan/Snakefile +++ b/tools/graphlan/graphlan/Snakefile @@ -1,5 +1,6 @@ -__graphlan_exec_command = config['graphlan'].get('exec_command', 'graphlan.py') -__graphlan_options = config['graphlan'].get('options', "") +__graphlan_exec_command = config.get('graphlan', {}).get('exec_command', 'graphlan.py') +__graphlan_modules = config.get('graphlan', {}).get('modules') +__graphlan_options = config.get('graphlan', {}).get('options', "") rule graphlan: input: @@ -8,6 +9,11 @@ rule graphlan: __graphlan_output params: exec_command = __graphlan_exec_command, + modules = __graphlan_modules, options = __graphlan_options - shell: - "{params.exec_command} {params.options} {input} {output}" + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} {params.options} {input} {output}") + shell(" && ".join(command)) \ No newline at end of file diff --git a/tools/graphlan/graphlan_annotate/Snakefile b/tools/graphlan/graphlan_annotate/Snakefile index 6a1b117..3a26ca9 100644 --- a/tools/graphlan/graphlan_annotate/Snakefile +++ b/tools/graphlan/graphlan_annotate/Snakefile @@ -1,5 +1,6 @@ -__graphlan_annotate_exec_command = config['graphlan_annotate'].get('exec_command', 'graphlan_annotate.py') -__graphlan_annotate_options = config['graphlan_annotate'].get('options', "") +__graphlan_annotate_exec_command = config.get('graphlan_annotate', {}).get('exec_command', 'graphlan_annotate.py') +__graphlan_annotate_modules = config.get('graphlan_annotate', {}).get('modules') +__graphlan_annotate_options = config.get('graphlan_annotate', {}).get('options', "") rule graphlan_annotate: input: @@ -9,6 +10,11 @@ rule graphlan_annotate: __graphlan_annotate_output params: exec_command = __graphlan_annotate_exec_command, + modules = __graphlan_annotate_modules, options = __graphlan_annotate_options - shell: - "{params.exec_command} {params.options} --annot {input.annot} {input.tree} {output}" + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} {params.options} --annot {input.annot} {input.tree} {output}") + shell(" && ".join(command)) -- GitLab