From 802b65e68ad7b8bcd700649eabd62cbc66b3944c Mon Sep 17 00:00:00 2001
From: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
Date: Thu, 2 Apr 2020 14:25:09 +0200
Subject: [PATCH] make estimates overrideable

---
 fastqc.wdl | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fastqc.wdl b/fastqc.wdl
index 7e693f6..b1a587c 100644
--- a/fastqc.wdl
+++ b/fastqc.wdl
@@ -38,11 +38,14 @@ task Fastqc {
         String? dir
 
         Int threads = 1
-        String memory = "1G"
+        String? memory
+        Int? runtimeMinutes
         String dockerImage = "quay.io/biocontainers/fastqc:0.11.9--0"
         Array[File]? NoneArray
         File? NoneFile
     }
+    String estimatedMemoryMB = "~{250 + 250 * threads}M"
+    Int estimatedRuntimeMin = 1 + ceil(size(seqFile, "G")) * 4
 
     # Chops of the .gz extension if present.
     # The Basename needs to be taken here. Otherwise paths might differ between similar jobs.
@@ -80,12 +83,11 @@ task Fastqc {
         Array[File]? images = if extract then glob(reportDir + "/Images/*.png") else NoneArray
     }
 
-    Int estimatedRuntime = 1 + ceil(size(seqFile, "G")) * 4
     runtime {
         cpu: threads
-        memory: memory
+        memory: select_first([memory, estimatedMemoryMB])
         docker: dockerImage
-        runtime_minutes: estimatedRuntime
+        runtime_minutes: select_first([runtimeMinutes, estimatedRuntimeMin])
     }
 
     parameter_meta {
-- 
GitLab