From f2052487ab7977d84f10d16ee5c6cd7d13d797b5 Mon Sep 17 00:00:00 2001
From: kehillio <kenzo-hugo.hillion1@pasteur.fr>
Date: Thu, 16 May 2019 16:59:19 +0200
Subject: [PATCH] fix way to build command line

---
 tools/metaphlan2/metaphlan2/Snakefile         | 6 ++++--
 tools/metaphlan2/metaphlan2_heatmap/Snakefile | 6 ++++--
 tools/metaphlan2/metaphlan2_merge/Snakefile   | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/metaphlan2/metaphlan2/Snakefile b/tools/metaphlan2/metaphlan2/Snakefile
index 0bee33c..4203f13 100644
--- a/tools/metaphlan2/metaphlan2/Snakefile
+++ b/tools/metaphlan2/metaphlan2/Snakefile
@@ -16,6 +16,8 @@ rule metaphlan2:
     threads:
         __metaphlan2_threads
     run:
+        command = []
         if params.modules:
-            shell("module load {params.modules}")
-        shell("{params.exec_command} --nproc {threads} --input_type {params.input_type} {params.options} {input} {output}")
+            command.append("module load {params.modules}")
+        command.append("{params.exec_command} --nproc {threads} --input_type {params.input_type} {params.options} {input} {output}")
+        shell(" && ".join(command))
diff --git a/tools/metaphlan2/metaphlan2_heatmap/Snakefile b/tools/metaphlan2/metaphlan2_heatmap/Snakefile
index 147e0cd..46fb5c0 100644
--- a/tools/metaphlan2/metaphlan2_heatmap/Snakefile
+++ b/tools/metaphlan2/metaphlan2_heatmap/Snakefile
@@ -12,6 +12,8 @@ rule heatmap:
         modules = __metaphlan2_heatmap_modules,
         options = __metaphlan2_heatmap_options
     run:
+        command = []
         if params.modules:
-        	shell("module load {params.modules}")
-        shell("{params.exec_command} {params.options} --in {input} --out {output}")
+        	command.append("module load {params.modules}")
+        command.append("{params.exec_command} {params.options} --in {input} --out {output}")
+        shell(" && ".join(command))
diff --git a/tools/metaphlan2/metaphlan2_merge/Snakefile b/tools/metaphlan2/metaphlan2_merge/Snakefile
index d986768..d7bba93 100644
--- a/tools/metaphlan2/metaphlan2_merge/Snakefile
+++ b/tools/metaphlan2/metaphlan2_merge/Snakefile
@@ -12,6 +12,8 @@ rule metaphlan2_merge:
         modules = __metaphlan2_merge_modules,
         options = __metaphlan2_merge_options
     run:
+        command = []
         if params.modules:
-            shell("module load {params.modules}")
-        shell("{params.exec_command} {params.options} {input} > {output}")
+            command.append("module load {params.modules}")
+        command.append("{params.exec_command} {params.options} {input} > {output}")
+        shell(" && ".join(command))
-- 
GitLab