-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnovosplit.sh
executable file
·87 lines (80 loc) · 2.9 KB
/
novosplit.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
if [ $# -gt 15 ]
then
MSG="parameter mismatch."
echo -e "jobid:${PBS_JOBID}\nprogram=$0 stopped at line=$LINENO.\nReason=$MSG" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline' "$redmine""
exit 1;
else
set -x
echo `date`
scriptfile=$0
alignerdir=$1
params=$2
ref=$3
outputdir=$4
samfile=$5
bamfile=$6
scriptdir=$7
samdir=$8
paired=$9
R1=${10}
parameters=$( echo $params | tr "_" " " )
## checking quality scores to gather additional params
qscores=$scriptdir/checkFastqQualityScores.pl
ill2sanger=`perl $qscores $R1 10000`
exitcode=$?
if [ $exitcode -ne 0 ]
then
MSG="checkfastqc command failed. exitcode=$exitcode novosplit alignment failed"
echo -e "program=$scriptfile stopped at line=$LINENO.\nReason=$MSG\n$LOGS" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline' "$redmine,$email""
exit $exitcode;
fi
if [ $ill2sanger -gt 65 ]
then
qual="-F ILMFQ"
else
qual="-F STDFQ"
fi
cd $outputdir
if [ $paired -eq 1 ]
then
R2=${11}
elog=${12}
olog=${13}
email=${14}
qsubfile=${15}
$alignerdir/novoalign -d $ref -f $R1 $R2 -o SAM $parameters $qual > $samfile
else
elog=${11}
olog=${12}
email=${13}
qsubfile=${14}
$alignerdir/novoalign -d $ref -f $R1 -o SAM $parameters $qual > $samfile
fi
exitcode=$?
LOGS="jobid:${PBS_JOBID}\nqsubfile=$qsubfile\nerrorlog=$elog\noutputlog=$olog"
if [ $exitcode -ne 0 ]
then
MSG="novoalign command failed. exitcode=$exitcode novosplit alignment failed"
echo -e "program=$scriptfile stopped at line=$LINENO.\nReason=$MSG\n$LOGS" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline' "$redmine,$email""
exit $exitcode;
fi
if [ ! -s $samfile ]
then
MSG="$outputdir/$samfile aligned file not created. novosplit alignment failed"
echo -e "program=$scriptfile stopped at line=$LINENO.\nReason=$MSG\n$LOGS" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline' "$redmine,$email""
exit 1;
fi
echo `date`
## sam2bam conversion
$samdir/samtools view -bS -o $bamfile $samfile
if [ ! -s $bamfile ]
then
MSG="$outputdir/$bamfile BAM file not created. sam2bam step failed during novosplit alignment."
echo -e "program=$scriptfile stopped at line=$LINENO.\nReason=$MSG\n$LOGS" | ssh iforge "mailx -s '[Support #200] Mayo variant identification pipeline' "$redmine,$email""
exit 1;
fi
echo `date`
fi