-
Notifications
You must be signed in to change notification settings - Fork 24
/
runAlignmentStats.sh
executable file
·48 lines (40 loc) · 1.17 KB
/
runAlignmentStats.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
#!/bin/bash
# Arun Seetharam
# 12/07/2017
if [ $# -lt 2 ] ; then
echo ""
echo ""
echo "usage: runAlignmentStats.sh <REFERENCE_GENOME> <SORTED_BAM_ALIGNMENT>"
echo ""
echo "Runs Picard tools to obtain summary stats about alignment and insert size"
echo "Also runs Qualimap to get more detailed statistics about various aspects of alignment"
echo "you can either supply a single bam file or regex matching a bunch of them"
echo "bam file MUST be co-ordiante sorted"
echo ""
echo ""
exit 0
fi
module load R
module load java
module load picard/2.9.0
module load samtools
module load GIF/qualimap
REF="$1"
shift
BAMS=${@};
for BAM in ${BAMS[@]}
do
if [ ! -f $BAM ]; then
echo "\"$BAM\" file not found!"
exit 1;
fi
if [ ${BAM##*.} != "bam" ]; then
echo "File $BAM is not a bam file!"
exit 1;
fi
picard CollectInsertSizeMetrics I=${BAM} O=${BAM%.*}_isize.txt H=${BAM%.*}_isize-histo.pdf M=0.5
picard CollectAlignmentSummaryMetrics REFERENCE_SEQUENCE=${REF} INPUT=$BAM OUTPUT=${BAM%.*}_align-stats.txt
unset DISPLAY
qualimap bamqc -bam ${BAM} --java-mem-size=80G -outdir ${BAM%.*}
done