From 6a0df09174529789a4bb6651ae992d0758d6a7eb Mon Sep 17 00:00:00 2001
From: DavyCats <davycats.dc@gmail.com>
Date: Thu, 26 Jul 2018 16:25:57 +0200
Subject: [PATCH] add vcfStats and Mutect2

---
 biopet.wdl | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gatk.wdl   | 45 ++++++++++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+)

diff --git a/biopet.wdl b/biopet.wdl
index 36d6f2a..a3ecdd0 100644
--- a/biopet.wdl
+++ b/biopet.wdl
@@ -417,3 +417,71 @@ task ValidateVcf {
         memory: ceil(memory * memoryMultiplier)
     }
 }
+
+task VcfStats {
+    input {
+        File vcfFile
+        File vcfIndex
+        File refFasta
+        File refFastaIndex
+        File refDict
+        String outDir
+        File? intervals
+        Array[String]+? infoTags
+        Array[String]+? genotypeTags
+        Int? sampleToSampleMinDepth
+        Int? binSize
+        Int? maxContigsInSingleJob
+        Boolean writeBinStats = false
+        Int localThreads = 1
+        Boolean notWriteContigStats = false
+        Boolean skipGeneral = false
+        Boolean skipGenotype = false
+        Boolean skipSampleDistributions = false
+        Boolean skipSampleCompare = false
+        String? sparkMaster
+        Int? sparkExecutorMemory
+        Array[String]+? sparkConfigValues
+
+        Int memory = 4
+        Float memoryMultiplier = 2.0
+        File? toolJar
+        String? preCommand
+    }
+
+    String toolCommand = if defined(toolJar)
+        then "java -Xmx" + memory + "G -jar " + toolJar
+        else "biopet-vcfstats -Xmx" + memory + "G"
+
+    command {
+        set -e -o pipefail
+        ~{preCommand}
+        ~{toolCommand} \
+        -I ~{vcfFile} \
+        -R ~{refFasta} \
+        -o ~{outDir} \
+        -t ~{localThreads} \
+        ~{"--intervals " + intervals} \
+        ~{true="--infoTag" false="" defined(infoTags)} ~{sep=" --infoTag " infoTags} \
+        ~{true="--genotypeTag" false="" defined(genotypeTags)} ~{sep=" --genotypeTag "
+            genotypeTags} \
+        ~{"--sampleToSampleMinDepth " + sampleToSampleMinDepth} \
+        ~{"--binSize " + binSize} \
+        ~{"--maxContigsInSingleJob " + maxContigsInSingleJob} \
+        ~{true="--writeBinStats" false="" writeBinStats} \
+        ~{true="--notWriteContigStats" false="" notWriteContigStats} \
+        ~{true="--skipGeneral" false="" skipGeneral} \
+        ~{true="--skipGenotype" false="" skipGenotype} \
+        ~{true="--skipSampleDistributions" false="" skipSampleDistributions} \
+        ~{true="--skipSampleCompare" false="" skipSampleCompare} \
+        ~{"--sparkMaster " + sparkMaster} \
+        ~{"--sparkExecutorMemory " + sparkExecutorMemory} \
+        ~{true="--sparkConfigValue" false="" defined(sparkConfigValues)} ~{
+            sep=" --sparkConfigValue" sparkConfigValues}
+    }
+
+    runtime {
+        cpu: localThreads
+        memory: ceil(memory * memoryMultiplier)
+    }
+}
diff --git a/gatk.wdl b/gatk.wdl
index 68281f3..75e45e5 100644
--- a/gatk.wdl
+++ b/gatk.wdl
@@ -293,6 +293,51 @@ task HaplotypeCallerGvcf {
     }
 }
 
+task MuTect2 {
+    input {
+        String? preCommand
+
+        Array[File]+ inputBams
+        File inputBamIndex
+        File refFasta
+        File refFastaIndex
+        File refDict
+        String outputVcf
+        String tumorSample
+        String? normalSample
+        Array[File]+ intervals
+
+        String? gatkJar
+        Int memory = 4
+        Float memoryMultiplier = 3
+    }
+
+    String toolCommand = if defined(gatkJar)
+        then "java -Xmx" + memory + "G -jar " + gatkJar
+        else "gatk --java-options -Xmx" + memory + "G"
+
+    command {
+        set -e -o pipefail
+        ~{preCommand}
+        ~{toolCommand} \
+        Mutect2 \
+        -R ~{refFasta} \
+        -I ~{sep=" -I " inputBams} \
+        -tumor ~{tumorSample} \
+        ~{"-normal " + normalSample} \
+        -O ~{outputVcf} \
+        -L ~{sep=" -L " intervals}
+    }
+
+    output {
+        File vcfFile = outputVcf
+    }
+
+    runtime {
+        memory: ceil(memory * memoryMultiplier)
+    }
+}
+
 task SplitNCigarReads {
     input {
         String? preCommand
-- 
GitLab