From 24520e97a9ffef02862c36b02bcfb2a542d79086 Mon Sep 17 00:00:00 2001
From: DavyCats <davycats.dc@gmail.com>
Date: Thu, 12 Apr 2018 14:21:59 +0200
Subject: [PATCH] fix Map key issue star

---
 star.wdl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/star.wdl b/star.wdl
index 9e01477..d7d3b7b 100644
--- a/star.wdl
+++ b/star.wdl
@@ -18,6 +18,9 @@ task Star {
     #TODO needs to be extended for all possible output extensions
     Map[String, String] samOutputNames = {"BAM SortedByCoordinate": "sortedByCoord.out.bam"}
 
+    # converts String? to String for use as key (for the Map above) in output
+    String key = select_first([outSAMtype, "BAM SortedByCoordinate"])
+
     command {
         set -e -o pipefail
         mkdir -p ${sub(outFileNamePrefix, basename(outFileNamePrefix) + "$", "")}
@@ -35,7 +38,7 @@ task Star {
     }
 
     output {
-        File bamFile = outFileNamePrefix + "Aligned." +  samOutputNames["${outSAMtype}"]
+        File bamFile = outFileNamePrefix + "Aligned." +  samOutputNames[key]
     }
 
     runtime {
-- 
GitLab