From 7a9d3cd46f13067df7eb9d719123d37875e02b50 Mon Sep 17 00:00:00 2001
From: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
Date: Mon, 28 Oct 2019 11:13:38 +0100
Subject: [PATCH] hisat should deliver an indexed bam

---
 hisat2.wdl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hisat2.wdl b/hisat2.wdl
index 305eb28..af2ae02 100644
--- a/hisat2.wdl
+++ b/hisat2.wdl
@@ -20,6 +20,9 @@ task Hisat2 {
         String dockerImage = "quay.io/biocontainers/mulled-v2-a97e90b3b802d1da3d6958e0867610c718cb5eb1:2388ff67fc407dad75774291ca5038f40cac4be0-0"
     }
 
+    # Select_first is needed, otherwise womtool validate fails.
+    String bamIndexPath = sub(select_first([outputBam]), "\.bam$", ".bai")
+
     command {
         set -e -o pipefail
         mkdir -p $(dirname ~{outputBam})
@@ -34,10 +37,12 @@ task Hisat2 {
         --rg 'PL:~{platform}' \
         ~{true="--dta" false="" downstreamTranscriptomeAssembly} \
         | samtools sort > ~{outputBam}
+        samtools index ~{outputBam} ~{bamIndexPath}
     }
 
     output {
         File bamFile = outputBam
+        File bamIndex = bamIndexPath
     }
 
     runtime {
-- 
GitLab