diff --git a/mutect2.inputs.json b/mutect2.inputs.json index cbf3161..4c7a080 100644 --- a/mutect2.inputs.json +++ b/mutect2.inputs.json @@ -1,5 +1,5 @@ { - "Mutect2.gatk_docker": "broadinstitute/gatk:4.1.4.0", + "Mutect2.gatk_docker": "broadinstitute/gatk:4.1.4.1", "Mutect2.intervals": "gs://gatk-best-practices/somatic-b37/whole_exome_agilent_1.1_refseq_plus_3_boosters.Homo_sapiens_assembly19.baits.interval_list", "Mutect2.scatter_count": 50, diff --git a/mutect2.wdl b/mutect2.wdl index 4f8d0c7..bdd5ea4 100644 --- a/mutect2.wdl +++ b/mutect2.wdl @@ -275,8 +275,6 @@ workflow Mutect2 { Int merged_vcf_size = ceil(size(M2.unfiltered_vcf, "GB")) Int merged_bamout_size = ceil(size(M2.output_bamOut, "GB")) - Int merged_tumor_pileups_size = ceil(size(M2.tumor_pileups, "GB")) - Int merged_normal_pileups_size = ceil(size(M2.tumor_pileups, "GB")) if (run_ob_filter) { call LearnReadOrientationModel { @@ -314,7 +312,7 @@ workflow Mutect2 { if (defined(variants_for_contamination)) { call MergePileupSummaries as MergeTumorPileups { input: - input_tables = M2.tumor_pileups, + input_tables = flatten(M2.tumor_pileups), output_name = output_basename, ref_dict = ref_dict, runtime_params = standard_runtime @@ -323,7 +321,7 @@ workflow Mutect2 { if (defined(normal_bam)){ call MergePileupSummaries as MergeNormalPileups { input: - input_tables = M2.normal_pileups, + input_tables = flatten(M2.normal_pileups), output_name = output_basename, ref_dict = ref_dict, runtime_params = standard_runtime @@ -596,10 +594,15 @@ task M2 { ~{true='--f1r2-tar-gz f1r2.tar.gz' false='' run_ob_filter} \ ~{m2_extra_args} + m2_exit_code=$? + ### GetPileupSummaries - # These must be created, even if they remain empty, as cromwell doesn't support optional output - touch tumor-pileups.table - touch normal-pileups.table + + # If the variants for contamination and the intervals for this scatter don't intersect, GetPileupSummaries + # throws an error. However, there is nothing wrong with an empty intersection for our purposes; it simply doesn't + # contribute to the merged pileup summaries that we create downstream. We implement this by with array outputs. + # If the tool errors, no table is created and the glob yields an empty array. + set +e if [[ ! -z "~{variants_for_contamination}" ]]; then gatk --java-options "-Xmx~{command_mem}m" GetPileupSummaries -R ~{ref_fasta} -I ~{tumor_bam} ~{"--interval-set-rule INTERSECTION -L " + intervals} \ @@ -610,6 +613,9 @@ task M2 { -V ~{variants_for_contamination} -L ~{variants_for_contamination} -O normal-pileups.table fi fi + + # the script only fails if Mutect2 itself fails + exit $m2_exit_code >>> runtime { @@ -630,8 +636,8 @@ task M2 { String normal_sample = read_string("normal_name.txt") File stats = "~{output_stats}" File f1r2_counts = "f1r2.tar.gz" - File tumor_pileups = "tumor-pileups.table" - File normal_pileups = "normal-pileups.table" + Array[File] tumor_pileups = glob("*tumor-pileups.table") + Array[File] normal_pileups = glob("*normal-pileups.table") } } @@ -726,7 +732,6 @@ task MergeStats { set -e export GATK_LOCAL_JAR=~{default="/root/gatk.jar" runtime_params.gatk_override} - gatk --java-options "-Xmx~{runtime_params.command_mem}m" MergeMutectStats \ -stats ~{sep=" -stats " stats} -O merged.stats } diff --git a/mutect2_pon.inputs.json b/mutect2_pon.inputs.json index 7f809d1..36ba1e2 100644 --- a/mutect2_pon.inputs.json +++ b/mutect2_pon.inputs.json @@ -1,7 +1,7 @@ { "Mutect2_Panel.pon_name":"panel_of_normal", - "Mutect2_Panel.normal_bams":"Array[File]", - "Mutect2_Panel.normal_bais":"Array[File]", + "Mutect2_Panel.normal_bams":"Array[String]", + "Mutect2_Panel.normal_bais":"Array[String]", "Mutect2_Panel.ref_fasta":"gs://gatk-best-practices/somatic-b37/Homo_sapiens_assembly19.fasta", "Mutect2_Panel.ref_fai":"gs://gatk-best-practices/somatic-b37/Homo_sapiens_assembly19.fasta.fai", @@ -12,5 +12,5 @@ "Mutect2_Panel.Mutect2.variants_for_contamination":"gs://gatk-best-practices/somatic-b37/small_exac_common_3.vcf", "Mutect2_Panel.gnomad":"gs://gatk-best-practices/somatic-b37/af-only-gnomad.raw.sites.vcf", - "Mutect2_Panel.gatk_docker":"broadinstitute/gatk:4.1.4.0" + "Mutect2_Panel.gatk_docker":"broadinstitute/gatk:4.1.4.1" }