Skip to content

Commit e2f8a55

Browse files
committed
fix graph ann, requires uncompressed VCF
1 parent e69074b commit e2f8a55

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Handlers/Create_HC_Subset.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ function Create_HC_Subset_GATK4() {
101101
echo "Checking if cutoffs have been changed..."
102102
# First check if we have a header line that starts with ##Create_HC_Subset_filter_cutoffs
103103
# This is used to check if our current cutoffs have been updated
104+
set -x # for debugging
104105
if grep -q "##Create_HC_Subset_filter_cutoffs" ${out}/Create_HC_Subset/Intermediates/${project}_filtered.vcf
105106
then
106107
# Expected header exists, check if cutoffs have been updated
@@ -248,6 +249,14 @@ function Create_HC_Subset_GATK4() {
248249
# rm -Rf "${out}/Intermediates" # Comment out this line if you need to debug this handler
249250

250251
# 8. Generate graphs showing distributions of variant annotations
252+
# First, check if VCF is compressed. If so, decompress temporarily
253+
if [[ ${raw_vcf} == *".gz"* ]]; then
254+
# Decompress VCF
255+
echo "Decompressing VCF file temporarily for graphing annotations..."
256+
file_prefix=$(basename ${raw_vcf} .vcf.gz)
257+
bgzip -dc ${raw_vcf} > ${out}/Create_HC_Subset/${file_prefix}.vcf
258+
raw_vcf=${out}/Create_HC_Subset/${file_prefix}.vcf
259+
fi
251260
source "${seqhand}/HelperScripts/graph_annotations.sh"
252261
vcf_prefix=Raw # Raw VCF file
253262
hc_prefix=HC # High Confidence
@@ -263,6 +272,8 @@ function Create_HC_Subset_GATK4() {
263272
"${vcf_prefix}" \
264273
"${hc_prefix}" \
265274
"pair"
275+
# Cleanup intermediate file to save space
276+
rm ${out}/Create_HC_Subset/${file_prefix}.vcf
266277
}
267278

268279
export -f Create_HC_Subset_GATK4

0 commit comments

Comments
 (0)