-
Notifications
You must be signed in to change notification settings - Fork 1
/
qualityCheck.sh
executable file
·49 lines (40 loc) · 1.09 KB
/
qualityCheck.sh
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
42
43
44
45
46
47
48
49
#!/bin/bash
#PBS -l nodes=1:ppn=4
QUALITYDIR="."
#### usage ####
usage() {
echo Program: "qualityCheck.sh (perform quality check on input fastq files)"
echo Author: BRIC, University of Copenhagen, Denmark
echo Version: 1.0
echo Contact: pundhir@binf.ku.dk
echo "Usage: qualityCheck.sh -i <file> [OPTIONS]"
echo " -i <file> [input fastq file with single end reads]"
echo "[OPTIONS]"
echo " -q <dir> [directory to store read quality report (default: .)]"
echo " -h [help]"
echo
exit 0
}
#### parse options ####
while getopts i:q:h ARG; do
case "$ARG" in
i) FASTQ=$OPTARG;;
q) QUALITYDIR=$OPTARG;;
h) HELP=1;;
esac
done
## usage, if necessary file and directories are given/exist
if [ ! -f "$FASTQ" -o "$HELP" ]; then
usage
fi
## check if output directory exists
echo -n "Create appropriate directory structure... "
if [ ! -d "$QUALITYDIR" ]; then
mkdir -p $QUALITYDIR
fi
echo "done"
## retrieve file name
ID=`echo $FASTQ | perl -ane '$_=~s/^.+\///g; $_=~s/\..+$//g; print $_;'`;
echo -n "Compute quality for $ID... "
eval fastqc \"$FASTQ\" -o $QUALITYDIR
echo "done"