Skip to content

Commit

Permalink
fix: throw error if trimmed fastq files are (nearly) empty
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Nov 22, 2024
1 parent 4d42da4 commit a08b4e4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
Binary file added tests/data/fastq/WT_S1.R1.trunc.fastq.gz
Binary file not shown.
Binary file added tests/data/fastq/WT_S1.R2.trunc.fastq.gz
Binary file not shown.
9 changes: 9 additions & 0 deletions workflow/rules/paired-end.smk
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,18 @@ rule trim_pe:
-m {params.minlen}:{params.minlen} \
-b file:{params.fastawithadaptersetd} -B file:{params.fastawithadaptersetd} \
-j {threads} -o {output.out1} -p {output.out2} {input.file1} {input.file2}
for f in {output.out1} {output.out2}; do
check_output=$(gzip -cd $f | head | wc -l)
if [ $check_output -lt 10 ]; then
echo "ERROR: Trimmed FastQ file is empty. $f"
exit 1
fi
done
"""




rule fastqc:
"""
Quality-control step to assess sequencing quality of the raw data after removing
Expand Down
10 changes: 10 additions & 0 deletions workflow/rules/single-end.smk
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ if config['options']['small_rna']:
-n 5 -O 5 -q {params.leadingquality},{params.trailingquality} \
-m 16 -b file:{params.fastawithadaptersetd} -j {threads} \
-o {output.outfq} {input.infq}
check_output=$(gzip -cd {output.outfq} | head | wc -l)
if [ $check_output -lt 10 ]; then
echo "ERROR: Trimmed FastQ file is empty."
exit 1
fi
"""
else:
# Use default trimming rule for long RNAs
Expand Down Expand Up @@ -120,6 +125,11 @@ else:
-n 5 -O 5 -q {params.leadingquality},{params.trailingquality} \
-m {params.minlen} -b file:{params.fastawithadaptersetd} -j {threads} \
-o {output.outfq} {input.infq}
check_output=$(gzip -cd {output.outfq} | head | wc -l)
if [ $check_output -lt 10 ]; then
echo "ERROR: Trimmed FastQ file is empty."
exit 1
fi
"""


Expand Down

0 comments on commit a08b4e4

Please sign in to comment.