-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvalidateFQPE.sbatch
41 lines (32 loc) · 1.19 KB
/
validateFQPE.sbatch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash -l
# check to see if fastq files are formatted correctly
#SBATCH --job-name=vld8FQ
#SBATCH -o valiate_FQ_-%j.out
#SBATCH --time=00:00:00
#SBATCH --cpus-per-task=40
enable_lmod
module load container_env fastq_utils
export SINGULARITY_BIND=/home/e1garcia
dirPATH=$1
fqPATTERN=$2
: ${dirPATH:="."}
fileEXTENSIONS=($(ls $dirPATH/$fqPATTERN | sed 's/.*\([\._][rR]*[12]\.fa*s*t*q\.gz\)/\1/g' | sort | uniq))
if [ ${#fileEXTENSIONS[@]} -gt 2 ]; then
echo "Error: Too many file extensions found: ${fileEXTENSIONS[*]}" >&2
exit 1
fi
ls $dirPATH/$fqPATTERN | \
sed 's/[\._][rR]*[12]\.fa*s*t*q\.gz//g' | \
uniq | \
parallel --no-notice -k crun.fastq_utils "fastq_info {}${fileEXTENSIONS[0]} {}${fileEXTENSIONS[1]}" &> $dirPATH/fqValidationReport.txt
echo PAIRED END FASTQ VALIDATION REPORT
echo
echo Directory: $dirPATH
echo File Pattern: $fqPATTERN
echo File extensions found: ${fileEXTENSIONS[*]}
echo
echo Number of paired end fq files evaluated: $(ls $dirPATH/$fqPATTERN | sed 's/[\._][rR]*[12]\.fa*s*t*q\.gz//g' | uniq | wc -l)
echo Number of paired end fq files validated: $(grep -c "^OK$" $dirPATH/fqValidationReport.txt)
echo
echo Errors Reported:
grep "^ERROR" $dirPATH/fqValidationReport.txt