-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbwabamS3.sh
executable file
·64 lines (58 loc) · 2.21 KB
/
bwabamS3.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
#!/bin/sh
if [ $# != 12 ]
then
MSG="parameter mismatch"
echo -e "jobid:${PBS_JOBID}\nprogram=$0 stooped at line=$LINENO.\nReason=$MSG" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline - Support #200' "[email protected]""
exit 1;
else
set -x
echo `date`
scriptfile=$0
alignerdir=$1
ref=$2
outputdir=$3
R1=$5
A1=$4
samfile=$6
bamfile=$7
samdir=$8
elog=$9
olog=${10}
email=${11}
qsubfile=${12}
LOGS="jobid:${PBS_JOBID}\nqsubfile=$qsubfile\nerrorlog=$elog\noutputlog=$olog"
cd $outputdir
$alignerdir/bwa samse $ref $A1 $R1 > $samfile
exitcode=$?
if [ $exitcode -ne o ]
then
MSG="bwa samse command failed. exitcode=$exitcode alignment failed"
echo -e "program=$scriptfile stopped at line=$LINENO.\nReason=$MSG\n$LOGS" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline' "$email""
exit $exitcode;
fi
if [ ! -s $samfile ]
then
MSG="$samfile aligned file not created. alignment failed"
echo -e "program=$scriptfile stopped at line=$LINENO.\nReason=$MSG\n$LOGS" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline - Support #200' "$email""
exit 1;
fi
echo `date`
## include sam2bam conversion
$samdir/samtools view -bS -o $bamfile $samfile
exitcode=$?
if [ $exitcode -ne o ]
then
MSG="samtools view command failed. exitcode=$exitcode alignment failed"
echo -e "program=$scriptfile stopped at line=$LINENO.\nReason=$MSG\n$LOGS" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline' "$email""
exit $exitcode;
fi
if [ ! -s $bamfile ]
then
MSG="$bamfile bam file not created. sam2bam step failed during alignment."
echo -e "program=$scriptfile stopped at line=$LINENO.\nReason=$MSG\n$LOGS" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline - Support #200' "$email""
exit 1;
fi
echo `date`
fi