From 01df29baef579cce73a32cd109d5405d45c197bd Mon Sep 17 00:00:00 2001
From: JasperBoom <jboom@infernum.nl>
Date: Tue, 11 Aug 2020 15:18:17 +0200
Subject: [PATCH] Change lima outputs.

---
 CHANGELOG.md  |  3 +--
 bam2fastx.wdl | 14 ++------------
 lima.wdl      |  9 ++++++---
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b839b35..57bbfec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,8 +11,7 @@ that users understand how the changes affect the new version.
 
 version 4.1.0-dev
 ---------------------------
-+ Add copy command to bam2fastx tasks to make sure bam file and its index are
-  always in the same directory.
++ Remove globs from lima outputs.
 + Added a task for GRIDSS.
 + Add wdl file for pacbio's bam2fastx tool.
 
diff --git a/bam2fastx.wdl b/bam2fastx.wdl
index 6a09202..5e5fb50 100644
--- a/bam2fastx.wdl
+++ b/bam2fastx.wdl
@@ -24,7 +24,6 @@ task Bam2Fasta {
     input {
         File inputFile
         File bamIndex
-        String basenameInputFile = basename(inputFile)
         String outputPrefix
         Int compressionLevel = 1
         Boolean splitByBarcode = false
@@ -39,16 +38,12 @@ task Bam2Fasta {
     command {
         set -e
         mkdir -p "$(dirname ~{outputPrefix})"
-        # The bam file and its index need to be in the same directory.
-        # Cromwell will put them in separate iputs folders.
-        cp ~{inputFile} ./
-        cp ~{bamIndex} ./
         bam2fasta \
         --output ~{outputPrefix} \
         -c ~{compressionLevel} \
         ~{true="--split-barcodes" false="" splitByBarcode} \
         ~{"--seqid-prefix " + seqIdPrefix} \
-        ./~{basenameInputFile}
+        ~{inputFile}
     }
 
     output {
@@ -81,7 +76,6 @@ task Bam2Fasta {
 task Bam2Fastq {
     input {
         File inputFile
-        String basenameInputFile = basename(inputFile)
         File bamIndex
         String outputPrefix
         Int compressionLevel = 1
@@ -97,16 +91,12 @@ task Bam2Fastq {
     command {
         set -e
         mkdir -p "$(dirname ~{outputPrefix})"
-        # The bam file and its index need to be in the same directory.
-        # Cromwell will put them in separate iputs folders.
-        cp ~{inputFile} ./
-        cp ~{bamIndex} ./
         bam2fastq \
         --output ~{outputPrefix} \
         -c ~{compressionLevel} \
         ~{true="--split-barcodes" false="" splitByBarcode} \
         ~{"--seqid-prefix " + seqIdPrefix} \
-        ./~{basenameInputFile}
+        ~{inputFile}
     }
 
     output {
diff --git a/lima.wdl b/lima.wdl
index 2e8a708..1a40b1c 100644
--- a/lima.wdl
+++ b/lima.wdl
@@ -95,12 +95,15 @@ task Lima {
         cp "~{basename(outputPrefix)}.fl.lima.counts" "~{outputPrefix}.fl.lima.counts"
         cp "~{basename(outputPrefix)}.fl.lima.report" "~{outputPrefix}.fl.lima.report"
         cp "~{basename(outputPrefix)}.fl.lima.summary" "~{outputPrefix}.fl.lima.summary"
+        find . -path "*.bam" > bamFiles.txt
+        find . -path "*.bam.pbi" > bamIndexes.txt
+        find . -path "*.subreadset.xml" > subreadsets.txt
     }
 
     output {
-        Array[File] limaBam = glob("*.bam")
-        Array[File] limaBamIndex = glob("*.bam.pbi")
-        Array[File] limaXml = glob("*.subreadset.xml")
+        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"
-- 
GitLab