From ff47f07c0657f717fbf2311b56cdd3ad3b23a7c2 Mon Sep 17 00:00:00 2001
From: JasperBoom <jboom@infernum.nl>
Date: Mon, 30 Nov 2020 17:22:38 +0100
Subject: [PATCH] Update lima.

---
 CHANGELOG.md |  2 ++
 lima.wdl     | 39 ++++++++++++++++-----------------------
 2 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a6cc9bf..0130372 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,8 @@ that users understand how the changes affect the new version.
 
 version 5.0.0-dev
 ---------------------------
++ mergePacBio: Rename `mergedReport` to `outputPathMergedReport`.
++ Lima: Fix copy commands.
 + Update Lima to version 2.0.0.
 + Update IsoSeq3 to version 3.4.0.
 + Update samtools to version 1.11.
diff --git a/lima.wdl b/lima.wdl
index c06a9a7..90cd698 100644
--- a/lima.wdl
+++ b/lima.wdl
@@ -56,7 +56,7 @@ task Lima {
 
     Map[String, String] libraryDesignOptions = {"same": "--same", "different": "--different", "neighbors": "--neighbors"}
 
-    command {
+    command <<<
         set -e
         mkdir -p "$(dirname ~{outputPrefix})"
         lima \
@@ -83,33 +83,26 @@ task Lima {
         ~{true="--peek-guess" false="" peekGuess} \
         --log-level ~{logLevel} \
         --num-threads ~{threads} \
-        ~{"--log-file " + outputPrefix + ".stderr.log"} \
+        ~{"--log-file " + outputPrefix + ".fl.stderr.log"} \
         ~{inputBamFile} \
         ~{barcodeFile} \
-        ~{outputPrefix + ".bam"}
+        ~{outputPrefix + ".fl.bam"}
 
-        # Copy the files with the default filename to the folder specified in
-        # outputPrefix.
-        if [[ -f "~{outputPrefix}.json" ]]
-        then
-            echo "Log files already at output location."
-        else
-            cp "~{basename(outputPrefix)}.json" "~{outputPrefix}.json"
-            cp "~{basename(outputPrefix)}.lima.counts" "~{outputPrefix}.lima.counts"
-            cp "~{basename(outputPrefix)}.lima.report" "~{outputPrefix}.lima.report"
-            cp "~{basename(outputPrefix)}.lima.summary" "~{outputPrefix}.lima.summary"
-        fi
-    }
+        dirName="$(dirname ~{outputPrefix})"
+        find "$(cd ${dirName}; pwd)" -name "*.fl.*.bam" > bamFiles.txt
+        find "$(cd ${dirName}; pwd)" -name "*.fl.*.bam.pbi" > bamIndexes.txt
+        find "$(cd ${dirName}; pwd)" -name "*.fl.*.subreadset.xml" > subreadsets.txt
+    >>>
 
     output {
-        Array[File] limaBam = glob("*.bam")
-        Array[File] limaBamIndex = glob("*.bam.pbi")
-        Array[File] limaXml = glob("*.subreadset.xml")
-        File limaStderr = outputPrefix + ".stderr.log"
-        File limaJson = outputPrefix + ".json"
-        File limaCounts = outputPrefix + ".lima.counts"
-        File limaReport = outputPrefix + ".lima.report"
-        File limaSummary = outputPrefix + ".lima.summary"
+        Array[File] limaBam = read_lines("bamFiles.txt")
+        Array[File] limaBamIndex = read_lines("bamIndexes.txt")
+        Array[File] limaXml = read_lines("subreadsets.txt")
+        File limaStderr = outputPrefix + ".fl.stderr.log"
+        File limaJson = outputPrefix + ".fl.json"
+        File limaCounts = outputPrefix + ".fl.lima.counts"
+        File limaReport = outputPrefix + ".fl.lima.report"
+        File limaSummary = outputPrefix + ".fl.lima.summary"
     }
 
     runtime {
-- 
GitLab