From ab88bc1ac6feaf4002d5849acec90bb61d523fd0 Mon Sep 17 00:00:00 2001
From: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
Date: Mon, 23 Jul 2018 13:33:46 +0200
Subject: [PATCH] mergecounts to 1.0

---
 mergecounts.wdl | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/mergecounts.wdl b/mergecounts.wdl
index 8cca5dd..9d87740 100644
--- a/mergecounts.wdl
+++ b/mergecounts.wdl
@@ -1,26 +1,29 @@
-task MergeCounts {
-    String? preCommand
-
-    Array[File] inputFiles
-    String outputFile
-    Int featureColumn
-    Int valueColumn
-    Boolean inputHasHeader
+version 1.0
 
+task MergeCounts {
+    input {
+        String? preCommand
+
+        Array[File] inputFiles
+        String outputFile
+        Int featureColumn
+        Int valueColumn
+        Boolean inputHasHeader
+    }
     # Based on a script by Szymon Kielbasa/Ioannis Moustakas
     command <<<
         set -e -o pipefail
-        mkdir -p ${sub(outputFile, basename(outputFile) + "$", "")}
-        ${preCommand}
+        mkdir -p ~{sub(outputFile, basename(outputFile) + "$", "")}
+        ~{preCommand}
         R --no-save <<CODE
             library(dplyr)
             library(reshape2)
 
-            listOfFiles <- c("${sep='", "' inputFiles}")
+            listOfFiles <- c("~{sep='", "' inputFiles}")
 
-            valueI <- ${valueColumn}
-            featureI <- ${featureColumn}
-            header <- ${true="TRUE" false="FALSE" inputHasHeader}
+            valueI <- ~{valueColumn}
+            featureI <- ~{featureColumn}
+            header <- ~{true="TRUE" false="FALSE" inputHasHeader}
 
             d <- do.call(rbind, lapply(listOfFiles, function(file){
                 d <- read.table(file, sep="\t", header=header, comment.char="#")
@@ -34,7 +37,7 @@ task MergeCounts {
             }))
 
             d <- d %>% dcast(feature ~ sample, value.var="count")
-            write.table(d, file="${outputFile}", sep="\t", quote=FALSE, row.names=FALSE)
+            write.table(d, file="~{outputFile}", sep="\t", quote=FALSE, row.names=FALSE)
         CODE
     >>>
 
-- 
GitLab