Skip to content

Commit

Permalink
add set -e -o pipefail to all relevant imputation tasks (#1434)
Browse files Browse the repository at this point in the history
Co-authored-by: Jose Soto <[email protected]>
  • Loading branch information
jsotobroad and Jose Soto authored Nov 21, 2024
1 parent fe04d7b commit e51628a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tasks/broad/ImputationTasks.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
>>>
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -715,6 +720,8 @@ task CountSamples {
}

command <<<
set -e -o pipefail

bcftools query -l ~{vcf} | wc -l
>>>
runtime {
Expand Down Expand Up @@ -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
>>>
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e51628a

Please sign in to comment.