From ca9c7e5c70bee29fa3c2a9a1935a9b7ae5187d61 Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Fri, 9 Oct 2015 19:03:26 +0200
Subject: [PATCH] Fix zcat for chunking

---
 .../scala/nl/lumc/sasc/biopet/extensions/Zcat.scala    |  2 +-
 .../sasc/biopet/pipelines/flexiprep/Flexiprep.scala    | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/public/biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Zcat.scala b/public/biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Zcat.scala
index 5c7ebd0ca..be5eb6700 100644
--- a/public/biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Zcat.scala
+++ b/public/biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Zcat.scala
@@ -36,7 +36,7 @@ class Zcat(val root: Configurable) extends BiopetCommandLineFunction {
 
   /** Returns command to execute */
   def cmdLine = required(executable) +
-    (if (inputAsStdin) "" else required(input)) +
+    (if (inputAsStdin) "" else repeat(input)) +
     (if (outputAsStsout) "" else " > " + required(output))
 }
 
diff --git a/public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Flexiprep.scala b/public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Flexiprep.scala
index 7b61aa4f9..e53c55cc5 100644
--- a/public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Flexiprep.scala
+++ b/public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Flexiprep.scala
@@ -253,8 +253,14 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
       throw new IllegalStateException("R1 and R2 file number is not the same")
 
     if (fastq_R1.length > 1) {
-      add(Zcat(this, fastq_R1, fastqR1Qc) | new Gzip(this) > fastqR1Qc)
-      if (paired) add(Zcat(this, fastq_R2, fastqR2Qc.get) | new Gzip(this) > fastqR2Qc.get)
+      val zcat = new Zcat(this)
+      zcat.input = fastq_R1
+      add(zcat | new Gzip(this) > fastqR1Qc)
+      if (paired) {
+        val zcat = new Zcat(this)
+        zcat.input = fastq_R2
+        add(zcat | new Gzip(this) > fastqR2Qc.get)
+      }
     }
 
     outputFiles += ("output_R1_gzip" -> fastqR1Qc)
-- 
GitLab