-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun_fastqc-chr22.sh
executable file
·65 lines (49 loc) · 1.74 KB
/
run_fastqc-chr22.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# run_fastqc.sh
# chr22 data
# we read and save data in the $BASE folder
echo $BASE
# first line processes all fastq while second takes only one dataset
#export RAWDATA=$BASE/SRP033351-chr22_fastq
export RAWDATA=$BASE/SRR1039509-chr22_fastq
export READQC=$BASE/SRR1039509-chr22_read_qc-Results
mkdir -p $READQC
# create an empty error log
cat /dev/null > $READQC/error.log
# max threads
thr=2
# process all fastq in folder
for fq in $RAWDATA/*.fastq.gz; do
name=${fq##*/}
prefix=${name%%.fastq.gz}
# perform a full QC control on the reads (-q for quiet, 4 threads)
# then convert results to PDF
echo "# run fastqc on ${fq}"
cmd="fastqc -f fastq --noextract -t ${thr} -o $READQC -q ${fq}"
echo "# ${cmd}"
eval ${cmd}
## add conversion to PDF
# htmldoc --webpage -f ${prefix}_fastqc.pdf ${prefix}_fastqc.html
## Use now another package 'FASTX toolkit' to produce additional QC data
# generate statistics for plots
# secret option '-Q 33' was added to fit with the phred scale
echo "# checking: ${name}"
zcat ${fq} | fastx_quality_stats -Q 33 -o $READQC/${name}_stats.txt \
2>> $READQC/error.log
# plot from the text summary file
fastq_quality_boxplot_graph.sh \
-i $READQC/${name}_stats.txt \
-o $READQC/${prefix}_boxplot.png
fastx_nucleotide_distribution_graph.sh \
-i $READQC/${name}_stats.txt \
-o $READQC/${prefix}_nuclplot.png
# also plot normalized base frequency using R (script code in appendix)
scripts/avgQdist2linePlot.R $READQC/${name}_stats.txt $READQC
done
# convert results to a nice PDF file
# requires htmldoc and dependencies installed on your machine
# htmldoc --webpage \
# --browserwidth 800 \
# --fontsize 7 \
# -f ${outfolder}/fastqc_report.pdf \
# ${outfolder}/fastqc_report.html10