From 61161df05a65d5a3f3427d381254988208266c98 Mon Sep 17 00:00:00 2001
From: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
Date: Fri, 28 Oct 2022 11:45:26 +0200
Subject: [PATCH] Add time_minutes dockerimage and update parameter_meta

---
 biowdl.wdl   |  2 +-
 bwa.wdl      | 16 ++++++++++++++--
 samtools.wdl |  4 +++-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/biowdl.wdl b/biowdl.wdl
index 463dab7..f891618 100644
--- a/biowdl.wdl
+++ b/biowdl.wdl
@@ -72,4 +72,4 @@ task InputConverter {
         # outputs
         json: {description: "JSON file version of the input sample sheet."}
     }
-}
\ No newline at end of file
+}
diff --git a/bwa.wdl b/bwa.wdl
index 8f694b4..e1e61bb 100644
--- a/bwa.wdl
+++ b/bwa.wdl
@@ -118,6 +118,8 @@ struct BwaIndex {
 task Index {
     input {
         File fasta
+        String dockerImage = "quay.io/biocontainers/bwa:0.7.17--hed695b0_7"
+        Int? timeMinutes = 5 + ceil(size(fasta, "G") * 5)
     }
     String indexedFile = basename(fasta)
 
@@ -141,8 +143,18 @@ task Index {
     }
 
     runtime {
-        docker: "quay.io/biocontainers/bwa:0.7.17--hed695b0_7"
+        docker: dockerImage
         cpu: 1
         memory: "~{size(fasta, 'G') + 1}GiB"
+        time_minutes: timeMinutes
+    }
+    parameter_meta {
+        # inputs
+        fasta: {description: "Reference fasta file.", category: "required"}
+        timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
+        dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
+
+        # outputs
+        index: {description: "The produced BWA index."}
     }
-}
\ No newline at end of file
+}
diff --git a/samtools.wdl b/samtools.wdl
index d5e3ce0..76a07ef 100644
--- a/samtools.wdl
+++ b/samtools.wdl
@@ -71,6 +71,7 @@ task DictAndFaidx {
         File inputFile
         String javaXmx = "2G"
         String memory = "3GiB"
+        Int timeMinutes = 5 + ceil(size(inputFile, "GiB") * 5)
         String dockerImage = "quay.io/biocontainers/samtools:1.11--h6270b1f_0"
     }
 
@@ -101,11 +102,12 @@ task DictAndFaidx {
         inputFile: {description: "The input fasta file.", category: "required"}
         javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
         memory: {description: "The amount of memory available to the job.", category: "advanced"}
+        timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
+        dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
         # outputs
         outputFasta: {description: "Fasta file that is co-located with the indexes"}
         outputFastaFai: {description: "Fasta index file for the outputFasta file."}
         outputFastaDict: {description: "Sequence dictionary for the outputFasta file."}
-        dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
     }
 }
 
-- 
GitLab