From e78386df65f7fc85c014735fe3a197a75110ed62 Mon Sep 17 00:00:00 2001
From: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
Date: Thu, 12 Dec 2019 15:02:22 +0100
Subject: [PATCH] added get chromsizes task

---
 bedtools.wdl | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/bedtools.wdl b/bedtools.wdl
index f6748f3..1695d83 100644
--- a/bedtools.wdl
+++ b/bedtools.wdl
@@ -20,6 +20,29 @@ version 1.0
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
+# Technically not a bedtools task, but needed for bedtools complement.
+task GetChromSizes {
+    input {
+        File faidx
+        # Debian for proper GNU Coreutils. Busybox sucks!
+        String dockerImage = "debian@sha256:f05c05a218b7a4a5fe979045b1c8e2a9ec3524e5611ebfdd0ef5b8040f9008fa"
+        String outputFile = basename(faidx, "\.fai") + ".genome"
+    }
+
+    # Get first two columns from the fasta index which note name and size.
+    command {
+        cut -f1,2 ~{faidx} > ~{outputFile}
+    }
+
+    output {
+        File chromSizes = outputFile
+    }
+
+    runtime {
+        docker: dockerImage
+    }
+}
+
 task Sort {
     input {
         File inputBed
-- 
GitLab