From 5fdf6d20d06189bd25f8daaa5635b9c2afa3ab57 Mon Sep 17 00:00:00 2001
From: DavyCats <davycats.dc@gmail.com>
Date: Thu, 7 Jun 2018 11:52:55 +0200
Subject: [PATCH] fix glob issue

---
 biopet.wdl | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/biopet.wdl b/biopet.wdl
index cc3a915..8dd6e78 100644
--- a/biopet.wdl
+++ b/biopet.wdl
@@ -70,26 +70,25 @@ task BaseCounter {
 task FastqSplitter {
     String? preCommand
     File inputFastq
-    String outputPath
-    Int numberChunks
-    String tool_jar
-    Array[Int] chunks = range(numberChunks)
+    Array[String] outputPaths
+    String toolJar
 
     command {
         set -e -o pipefail
         ${preCommand}
-        mkdir -p ${sep=' ' prefix(outputPath + "/chunk_", chunks)}
-        if [ ${numberChunks} -gt 1 ]; then
-            SEP="/${basename(inputFastq)} -o "
-            java -jar ${tool_jar} -I ${inputFastq} -o ${sep='$SEP' prefix(outputPath + "/chunk_", chunks)}/${basename(inputFastq)}
-        else
-            ln -sf ${inputFastq} ${outputPath}/chunk_0/${basename(inputFastq)}
-        fi
+        for
+        mkdir -p $(dirname ${sep=') $(dirname ' outputPaths})
+        if [ ${length(outputPaths)} -gt 1 ]; then
+            java -jar ${toolJar} \
+            -I ${inputFastq} \
+            -o ${sep=' -o ' outputPaths}
+          else
+            ln -sf ${inputFastq} ${outputPaths[0]}
+          fi
     }
 
     output {
-        Array[File] chunkDirs = prefix(outputPath + "/chunk_", chunks)
-        String filename = basename(inputFastq)
+        Array[File] chunks = outputPaths
     }
 }
 
-- 
GitLab