diff --git a/biopet/sampleconfig.wdl b/biopet/sampleconfig.wdl index 61defae84ff0583b3515f16a8e6948bbc564c84a..3e530ac5c6df802af99564d0af537cb19140ebdc 100644 --- a/biopet/sampleconfig.wdl +++ b/biopet/sampleconfig.wdl @@ -1,5 +1,7 @@ version 1.0 +import "../common.wdl" as common + task SampleConfig { input { File? toolJar @@ -77,3 +79,41 @@ task SampleConfigCromwellArrays { memory: ceil(memory * memoryMultiplier) } } + +task CaseControl { + input { + File? toolJar + String? preCommand + Array[File]+ inputFiles + Array[File]+ sampleConfigs + String outputPath + String controlTag = "control" + + Int memory = 4 + Float memoryMultiplier = 1.5 + } + + String toolCommand = if defined(toolJar) + then "java -Xmx" + memory + "G -jar " + toolJar + else "biopet-sampleconfig -Xmx" + memory + "G" + + command { + set -e -o pipefail + ~{preCommand} + mkdir -p $(dirname ~{outputPath}) + ~{toolCommand} CromwellArrays \ + -i ~{sep="-i " inputFiles} \ + -s ~{sep="-s " sampleConfigs} \ + ~{"-o " + outputPath} \ + ~{"--controlTag " + controlTag} + } + + output { + File outputFile = outputPath + Array[CaseControl] caseControls = read_json(outputFile) + } + + runtime { + memory: ceil(memory * memoryMultiplier) + } +} diff --git a/common.wdl b/common.wdl index af3b66bf470be5da4cf72ca1bcb8d5cc77cacb88..c618cbfdf7d155d6b783f3d8bb8b8dc201fd8d0e 100644 --- a/common.wdl +++ b/common.wdl @@ -163,3 +163,10 @@ struct FastqPair { File? R2 File? R2_md5 } + +struct CaseControl { + String inputName + IndexedBamFile inputBam + String controlName + IndexedBamFile controlBam +} diff --git a/gatk.wdl b/gatk.wdl index 99a5b2c472b2b812cdcdae9a0b6cfa5ff454599d..25c273a6a8779cbfcbb05512199210d2c121f523 100644 --- a/gatk.wdl +++ b/gatk.wdl @@ -123,18 +123,12 @@ task CombineGVCFs { command { set -e -o pipefail ~{preCommand} - - if [ ~{length(gvcfFiles)} -gt 1 ]; then - ~{toolCommand} \ - CombineGVCFs \ - -R ~{reference.fasta} \ - -O ~{outputPath} \ - -V ~{sep=' -V ' gvcfFiles} \ - -L ~{sep=' -L ' intervals} - else # TODO this should be handeled in wdl - ln -sf ~{gvcfFiles[0]} ~{outputPath} - ln -sf ~{gvcfFiles[0]} ~{outputPath}.tbi - fi + ~{toolCommand} \ + CombineGVCFs \ + -R ~{reference.fasta} \ + -O ~{outputPath} \ + -V ~{sep=' -V ' gvcfFiles} \ + -L ~{sep=' -L ' intervals} } output {