From d1229d3e746ce804d627e1e4af0ab09917e49923 Mon Sep 17 00:00:00 2001
From: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
Date: Tue, 4 Jun 2019 11:55:32 +0200
Subject: [PATCH] rewrite tabix

---
 samtools.wdl | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/samtools.wdl b/samtools.wdl
index c4c8126..befa335 100644
--- a/samtools.wdl
+++ b/samtools.wdl
@@ -182,17 +182,24 @@ task Fastq {
 
 task Tabix {
     input {
-        String inputFile
+        File inputFile
+        String outputFilePath = "indexed.vcf.gz"
         String type = "vcf"
         String dockerTag = "0.2.6--ha92aebf_0"
     }
 
     command {
-        tabix ~{inputFile} -p ~{type}
+        set -e
+        if [ ! -f ~{outputFilePath} ]
+        then
+            ln ~{inputFile} ~{outputFilePath}
+        fi
+        tabix ~{outputFilePath} -p ~{type}
     }
 
     output {
-        File index = inputFile + ".tbi"
+        File indexedFile = outputFilePath
+        File index = outputFilePath + ".tbi"
     }
 
     runtime {
-- 
GitLab