From a772e3773feedcb22f7e18f8a1f0130fd9b3cf0c Mon Sep 17 00:00:00 2001
From: DavyCats <davycats.dc@gmail.com>
Date: Fri, 16 Oct 2020 15:08:33 +0200
Subject: [PATCH] add gripss, timeMinutes for gridss, fix typos

---
 bcftools.wdl |   2 +-
 gridss.wdl   |   7 ++-
 gripss.wdl   | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++
 snpeff.wdl   |   2 +-
 4 files changed, 124 insertions(+), 4 deletions(-)
 create mode 100644 gripss.wdl

diff --git a/bcftools.wdl b/bcftools.wdl
index 0be3be9..e68e527 100644
--- a/bcftools.wdl
+++ b/bcftools.wdl
@@ -150,7 +150,7 @@ task Filter {
         ~{vcf} \
         -O z \
         -o ~{outputPath}
-        bctools index --tbi ~{outputPath}
+        bcftools index --tbi ~{outputPath}
     }
 
     output {
diff --git a/gridss.wdl b/gridss.wdl
index 44b9e9f..7516553 100644
--- a/gridss.wdl
+++ b/gridss.wdl
@@ -1,6 +1,6 @@
 version 1.0
 
-# Copyright (c) 2017 Leiden University Medical Center
+# Copyright (c) 2020 Leiden University Medical Center
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -34,7 +34,8 @@ task GRIDSS {
         String outputPrefix = "gridss"
 
         Int jvmHeapSizeGb = 30
-        Int threads = 1
+        Int threads = 2
+        Int timeMinutes = ceil(1440 / threads) + 10
         String dockerImage = "quay.io/biocontainers/gridss:2.9.4--0"
     }
 
@@ -64,6 +65,7 @@ task GRIDSS {
     runtime {
         cpu: threads
         memory: "~{jvmHeapSizeGb + 1}G"
+        time_minutes: timeMinutes
         docker: dockerImage
     }
 
@@ -79,6 +81,7 @@ task GRIDSS {
 
         threads: {description: "The number of the threads to use.", category: "advanced"}
         jvmHeapSizeGb: {description: "The size of JVM heap for assembly and variant calling",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"}
     }
 }
\ No newline at end of file
diff --git a/gripss.wdl b/gripss.wdl
new file mode 100644
index 0000000..6ed0bcf
--- /dev/null
+++ b/gripss.wdl
@@ -0,0 +1,117 @@
+version 1.0
+
+# Copyright (c) 2020 Leiden University Medical Center
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+task ApplicationKt {
+    input {
+        File inputVcf
+        String outputPath = "gripss.vcf.gz"
+        File referenceFasta
+        File breakpointHotspot
+        File breakendPon
+        File breakpointPon
+
+        String memory = "25G"
+        String javaXmx = "24G"
+        Int timeMinutes = 60
+        String dockerImage = "quay.io/biocontainers/hmftools-gripss:1.8--0"
+    }
+
+    command {
+        java -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
+        -cp /usr/local/share/hmftools-gripss-1.8-0/gripss.jar \
+        com.hartwig.hmftools.gripss.GripssApplicationKt \
+        -ref_genome	~{referenceFasta} \
+        -breakpoint_hotspot ~{breakpointHotspot} \
+        -breakend_pon ~{breakendPon} \
+        -breakpoint_pon ~{breakpointPon} \
+        -input_vcf ~{inputVcf} \
+        -output_vcf ~{outputPath} 
+    }
+
+    output {
+        File outputVcf = outputPath
+        File outputVcfIndex = outputPath + ".tbi"
+    }
+
+    runtime {
+        memory: memory
+        time_minutes: timeMinutes
+        docker: dockerImage
+    }
+
+    parameter_meta {
+        inputVcf: {description: "The input VCF.", category: "required"}
+        outputPath: {description: "The path where th eoutput VCF will be written.", category: "common"}
+        referenceFasta: {description: "The reference fasta file.", category: "advanced"}
+        breakpointHotspot: {description: "Equivalent to the `-breakpoint_hotspot` option.", category: "required"}
+        breakendPon: {description: "Equivalent to the `-breakend_pon` option.", category: "required"}
+        breakpointPon: {description: "Equivalent to the `breakpoint_pon` option.", category: "required"}
+        memory: {description: "The amount of memory this job will use.", category: "advanced"}
+        javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.",
+                  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"}
+    }
+}
+
+task HardFilterApplicationKt {
+    input {
+        File inputVcf
+        String outputPath = "gripss_hard_filter.vcf.gz"
+
+        String memory = "25G"
+        String javaXmx = "24G"
+        Int timeMinutes = 60
+        String dockerImage = "quay.io/biocontainers/hmftools-gripss:1.8--0"
+    }
+
+    command {
+        java -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
+        -cp /usr/local/share/hmftools-gripss-1.8-0/gripss.jar \
+        com.hartwig.hmftools.gripss.GripssHardFilterApplicationKt \
+        -input_vcf ~{inputVcf} \
+        -output_vcf ~{outputPath} 
+    }
+
+    output {
+        File outputVcf = outputPath
+        File outputVcfIndex = outputPath + ".tbi"
+    }
+
+    runtime {
+        memory: memory
+        time_minutes: timeMinutes
+        docker: dockerImage
+    }
+
+    parameter_meta {
+        inputVcf: {description: "The input VCF.", category: "required"}
+        outputPath: {description: "The path where th eoutput VCF will be written.", category: "common"}
+        memory: {description: "The amount of memory this job will use.", category: "advanced"}
+        javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.",
+                  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"}
+    }
+}
\ No newline at end of file
diff --git a/snpeff.wdl b/snpeff.wdl
index 079a720..d639a03 100644
--- a/snpeff.wdl
+++ b/snpeff.wdl
@@ -24,7 +24,7 @@ task SnpEff {
         set -e
         mkdir -p "$(dirname ~{outputPath})"
         unzip ~{datadirZip}
-        snpEff -Xmx~{javaXmx}  -XX:ParallelGCThreads=1 \
+        snpEff -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
         -v \
         ~{genomeVersion} \
         -noDownload \
-- 
GitLab