Skip to content

Commit

Permalink
update error messages snippy variants
Browse files Browse the repository at this point in the history
  • Loading branch information
fraser-combe committed Oct 21, 2024
1 parent ee2014a commit deebfd4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tasks/gene_typing/variant_detection/task_snippy_variants.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ task snippy_variants {
reference_length_passed_depth=$(cat "~{samplename}/~{samplename}_depth_~{min_coverage}.tsv" | wc -l)
echo $reference_length_passed_depth | tee REFERENCE_LENGTH_PASSED_DEPTH

# check if reference_length is equal to 0, if so, output a warning
if [ "$reference_length" -eq 0 ]; then
echo "0" > PERCENT_REF_COVERAGE
echo "Could not compute percent reference coverage: reference length is 0" > PERCENT_REF_COVERAGE
else
echo $reference_length_passed_depth $reference_length | awk '{ printf("%.2f", ($1/$2)*100) }' > PERCENT_REF_COVERAGE
fi
Expand All @@ -96,7 +97,7 @@ task snippy_variants {
total_reads=$(samtools view -c "~{samplename}/~{samplename}.bam")
echo $total_reads > TOTAL_READS
if [ "$total_reads" -eq 0 ]; then
echo "0" > PERCENT_READS_ALIGNED
echo "Could not compute percent reads aligned: total reads is 0" > PERCENT_READS_ALIGNED
else
echo $reads_aligned $total_reads | awk '{ printf("%.2f", ($1/$2)*100) }' > PERCENT_READS_ALIGNED
fi
Expand Down

0 comments on commit deebfd4

Please sign in to comment.