From e51628ae7df53dae9fc122a13e3f84e9200a4639 Mon Sep 17 00:00:00 2001 From: jsotobroad Date: Thu, 21 Nov 2024 10:23:42 -0500 Subject: [PATCH] add set -e -o pipefail to all relevant imputation tasks (#1434) Co-authored-by: Jose Soto --- tasks/broad/ImputationTasks.wdl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tasks/broad/ImputationTasks.wdl b/tasks/broad/ImputationTasks.wdl index 86b6a1f5ec..6fbf87334b 100644 --- a/tasks/broad/ImputationTasks.wdl +++ b/tasks/broad/ImputationTasks.wdl @@ -12,6 +12,8 @@ task CalculateChromosomeLength { } command { + set -e -o pipefail + grep -P "SN:~{chrom}\t" ~{ref_dict} | sed 's/.*LN://' | sed 's/\t.*//' } runtime { @@ -38,6 +40,8 @@ task GetMissingContigList { } command <<< + set -e -o pipefail + grep "@SQ" ~{ref_dict} | sed 's/.*SN://' | sed 's/\t.*//' > contigs.txt awk 'NR==FNR{arr[$0];next} !($0 in arr)' ~{included_contigs} contigs.txt > missing_contigs.txt >>> @@ -543,7 +547,6 @@ task UpdateHeader { String disable_sequence_dict_validation_flag = if disable_sequence_dictionary_validation then "--disable-sequence-dictionary-validation" else "" command <<< - ## update the header of the merged vcf gatk --java-options "-Xms~{command_mem}m -Xmx~{max_heap}m" \ UpdateVCFSequenceDictionary \ @@ -644,6 +647,7 @@ task OptionalQCSites { Float hwe = select_first([optional_qc_hwe, 0.000001]) command <<< set -e -o pipefail + ln -sf ~{input_vcf} input.vcf.gz ln -sf ~{input_vcf_index} input.vcf.gz.tbi @@ -676,6 +680,7 @@ task MergeSingleSampleVcfs { } command <<< set -e -o pipefail + # Move the index file next to the vcf with the corresponding name declare -a VCFS=(~{sep=' ' input_vcfs}) @@ -715,6 +720,8 @@ task CountSamples { } command <<< + set -e -o pipefail + bcftools query -l ~{vcf} | wc -l >>> runtime { @@ -915,6 +922,7 @@ task SetIDs { } command <<< set -e -o pipefail + bcftools annotate ~{vcf} --set-id '%CHROM\:%POS\:%REF\:%FIRST_ALT' -Oz -o ~{output_basename}.vcf.gz bcftools index -t ~{output_basename}.vcf.gz >>> @@ -1074,6 +1082,8 @@ task FindSitesUniqueToFileTwoOnly { Int disk_size_gb = ceil(size(file1, "GiB") + 2*size(file2, "GiB")) + 10 } command <<< + set -e -o pipefail + comm -13 <(sort ~{file1} | uniq) <(sort ~{file2} | uniq) > missing_sites.ids >>> runtime {