diff --git a/gatk.wdl b/gatk.wdl index 75e45e5904f7f30447ffb0c579988c028e9dadc9..3d4bf9231de1cc4259e10ca1c9ba9cebc34ae4e6 100644 --- a/gatk.wdl +++ b/gatk.wdl @@ -142,8 +142,8 @@ task CombineGVCFs { -V ~{sep=' -V ' gvcfFiles} \ -L ~{sep=' -L ' intervals} else # TODO this should be handeled in wdl - ln -sf ~{select_first(gvcfFiles)} ~{outputPath} - ln -sf ~{select_first(gvcfFileIndexes)} ~{outputPath}.tbi + ln -sf ~{gvcfFiles[0]} ~{outputPath} + ln -sf ~{gvcfFileIndexes[0]} ~{outputPath}.tbi fi } @@ -298,7 +298,7 @@ task MuTect2 { String? preCommand Array[File]+ inputBams - File inputBamIndex + Array[File]+ inputBamIndex File refFasta File refFastaIndex File refDict @@ -331,6 +331,7 @@ task MuTect2 { output { File vcfFile = outputVcf + File vcfIndex = outputVcf + ".tbi" } runtime { diff --git a/manta.wdl b/manta.wdl new file mode 100644 index 0000000000000000000000000000000000000000..e2c59eb425722347de5608297adc43af3cb61185 --- /dev/null +++ b/manta.wdl @@ -0,0 +1,63 @@ +version 1.0 + +task Somatic { + input { + File tumorBam + File tumorIndex + File? normalBam + File? normalIndex + File refFasta + File refFastaIndex + String runDir + File? callRegions + File? callRegionsIndex + Boolean exome = false + String? preCommand + String? installDir + + Int cores = 1 + Int memory = 4 + } + + String toolCommand = if defined(installDir) + then installDir + "bin/configMata.py" + else "configManta.py" + + command { + set -e -o pipefail + ~{preCommand} + ~{toolCommand} \ + ~{"--normalBam " + normalBam} \ + ~{"--tumorBam " + tumorBam} \ + --referenceFasta ~{refFasta} \ + ~{"--callRegions " + callRegions} \ + --runDir ~{runDir} \ + ~{true="--exome" false="" exome} + + ~{runDir}/runWorkflow.py \ + -m local \ + -j ~{cores} \ + -g ~{memory} + } + + output { + File condidateSmallIndels = runDir + "/results/variants/candidateSmallIndels.vcf.gz" + File condidateSmallIndelsIndex = runDir + + "/results/variants/candidateSmallIndels.vcf.gz.tbi" + File candidateSV = runDir + "/results/variants/candidateSV.vcf.gz" + File candidateSVindex = runDir + "/results/variants/candidateSV.vcf.gz.tbi" + File tumorSV = if defined(normalBam) + then runDir + "/results/variants/somaticSV.vcf.gz" + else runDir + "/results/variants/tumorSV.vcf.gz" + File tumorSVindex = if defined(normalBam) + then runDir + "/results/variants/somaticSV.vcf.gz.tbi" + else runDir + "/results/variants/tumorSV.vcf.gz.tbi" + File? diploidSV = "/results/variants/diploidSV.vcf.gz" + File? diploidSVindex = "/results/variants/diploidSV.vcf.gz.tbi" + } + + runtime { + cpu: cores + memory: memory + } +} \ No newline at end of file diff --git a/picard.wdl b/picard.wdl index ac372b1f078f61d2d3fdcee727fefb63dc789295..4132754149ebcab5e777f2e9d90c4266cc38db4e 100644 --- a/picard.wdl +++ b/picard.wdl @@ -378,3 +378,38 @@ task ScatterIntervalList { memory: ceil(memory * memoryMultiplier) } } + +task SortVcf { + input { + String? preCommand + String? picardJar + + Array[File]+ vcfFiles + String outputVcf + + Int memory = 4 + Float memoryMultiplier = 3.0 + } + + String toolCommand = if defined(picardJar) + then "java -Xmx" + memory + "G -jar " + picardJar + else "picard -Xmx" + memory + "G" + + command { + set -e -o pipefail + ~{preCommand} + ~{toolCommand} \ + SortVcf \ + I=~{sep=" I=" vcfFiles} \ + O=outputVcf + } + + output { + File vcfFile = outputVcf + File vcfIndex = outputVcf + ".tbi" + } + + runtime { + memory: ceil(memory * memoryMultiplier) + } +} \ No newline at end of file diff --git a/samtools.wdl b/samtools.wdl index 2d910379db88bb9402df50c2e0704e08263a9ff7..58bdcfd85b61264990af124e847a76faceefffef 100644 --- a/samtools.wdl +++ b/samtools.wdl @@ -1,5 +1,25 @@ version 1.0 +task BgzipAndIndex { + input { + File inputFile + String outputDir + String type = "vcf" + } + + String outputGz = outputDir + "/" + basename(inputFile) + ".gz" + + command { + bgzip -c ~{inputFile} > ~{outputGz} + tabix ~{outputGz} -p ~{type} + } + + output { + File compressed = outputGz + File index = outputGz + ".tbi" + } +} + task Index { input { String? preCommand @@ -131,6 +151,21 @@ task Fastq { } } +task Tabix { + input { + String inputFile + String type = "vcf" + } + + command { + tabix ~{inputFile} -p ~{type} + } + + output { + File index = inputFile + ".tbi" + } +} + task View { input { String? preCommand @@ -157,7 +192,7 @@ task View { ~{"-f " + includeFilter} \ ~{"-F " + excludeFilter} \ ~{"-G " + excludeSpecificFilter} \ - ~{"--threads " + threads - 1} \ + ~{"--threads " + (threads - 1)} \ ~{inFile} } diff --git a/strelka.wdl b/strelka.wdl index 29e2a078ef59390d1dfceef3b093b25c0ea32236..cc3682fffeb6bfe8c9fa5241ff04d9670cb118cc 100644 --- a/strelka.wdl +++ b/strelka.wdl @@ -1,13 +1,72 @@ version 1.0 +task Germline { + input { + String? preCommand + String? installDir + String runDir + Array[File]+ bams + Array[File]+ indexes + File refFasta + File refFastaIndex + File? callRegions + File? callRegionsIndex + Boolean exome = false + Boolean rna = false + + Int cores = 1 + Int memory = 4 + } + + String toolCommand = if defined(installDir) + then installDir + "bin/configureStrelkaGermlineWorkflow.py" + else "configureStrelkaGermlineWorkflow.py" + + command { + set -e -o pipefail + ~{preCommand} + ~{toolCommand} \ + --bam ~{sep=" --bam " bams} \ + --ref ~{refFasta} \ + --runDir ~{runDir} \ + ~{"--callRegions " + callRegions} \ + ~{true="--exome" false="" exome} \ + ~{true="--rna" false="" rna} + + ~{runDir}/runWorkflow.py \ + -m local \ + -j ~{cores} \ + -g ~{memory} + } + + output { + File variants = runDir + "/results/variants/variants.vcf.gz" + File variantsIndex = runDir + "/results/variants/variants.vcf.gz.tbi" + } + + runtime { + cpu: cores + memory: memory + } +} + + task Somatic { input { String? preCommand String? installDir String runDir File normalBam + File normalIndex File tumorBam + File tumorIndex File refFasta + File refFastaIndex + File? callRegions + File? callRegionsIndex + File? indelCandidates + File? indelCandidatesIndex + Boolean exome = false Int cores = 1 Int memory = 4 @@ -24,11 +83,14 @@ task Somatic { --normalBam ~{normalBam} \ --tumorBam ~{tumorBam} \ --ref ~{refFasta} \ - --runDir ~{runDir} + --runDir ~{runDir} \ + ~{"--callRegions " + callRegions} \ + ~{"--indelCandidates " + indelCandidates} \ + ~{true="--exome" false="" exome} \ ~{runDir}/runWorkflow.py \ -m local \ - -J ~{cores} \ + -j ~{cores} \ -g ~{memory} } diff --git a/vardict.wdl b/vardict.wdl index 9dbb0ac49471f84ad88eb2a7c003f66ef39f9be2..a421fd785abb9f5786cb0c9781f294c5525c60fd 100644 --- a/vardict.wdl +++ b/vardict.wdl @@ -3,13 +3,17 @@ version 1.0 task VarDict { input { String? installDir + Boolean useJavaVersion = true + String tumorSampleName File tumorBam - File normalBam + File tumorIndex + String? normalSampleName + File? normalBam + File? normalIndex File refFasta + File refFastaIndex File bedFile - String tumorSampleName - String normalSampleName String outputVcf Int chromosomeColumn = 1 @@ -22,7 +26,9 @@ task VarDict { String toolCommand = if defined(installDir) then installDir + "/VarDict" - else "vardict" + else if useJavaVersion + then "vardict-java" #probably needs memory stuff + else "vardict" command { set -e -o pipefail @@ -30,19 +36,21 @@ task VarDict { ~{toolCommand} \ -G ~{refFasta} \ -N ~{tumorSampleName} \ - -b "~{tumorBam}|~{normalBam}" \ + -b "~{tumorBam}~{"|" + normalBam}" \ -c ~{chromosomeColumn} \ -S ~{startColumn} \ -E ~{endColumn} \ -g ~{geneColumn} \ ~{bedFile} | \ - ~{installDir + "/"}testsomatic.R | \ - ~{installDir + "/"}var2vcf_paired.pl \ - -N "~{tumorSampleName}|~{normalSampleName}" \ - > ~{outputVcf} + ~{installDir + "/"}~{true="testsomatic.R" false="teststrandbias.R" defined(normalBam)} | \ + ~{installDir + "/"}~{true="var2vcf_paired.pl" + false="var2vcf_valid.pl" defined(normalBam)} \ + -N "~{tumorSampleName}~{"|" + normalSampleName}" \ + ~{true="" false="-E" defined(normalBam)} | \ + bgzip -c > ~{outputVcf} } output { File vcfFile = outputVcf } -} \ No newline at end of file +}