-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbwaMapSE.sh
executable file
·110 lines (65 loc) · 2.36 KB
/
bwaMapSE.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
source ~/.bashrc
source fileUtils.sh
source ./initvars.sh
source $configDir/bwa.config.sh
source $tophatshvar
saveIFS=$IFS
IFS=`echo -en ","`
declare -a samples=($Samples)
IFS=$saveIFS
###nodenum=1
for sample in ${samples[*]}; do
echo "initiate tophat for sample $sample"
vname=${sample}
lfilelist=${!vname}
IFS=`echo -en ","`
declare -a lfilelist=($lfilelist)
sizeFile=${#lfilelist[@]}
if [ ! -d $saiDir ]; then
mkdir $saiDir
fi
if [ ! -d $sampeDir ]; then
mkdir $sampeDir
fi
if [ ! -d $samseDir ]; then
mkdir $samseDir
fi
sampleSampeOutDir=$sampeDir/$sample
sampleSamseOutDir=$samseDir/$sample
if [ ! -d $sampleSampeOutDir ];then
mkdir $sampleSampeOutDir
fi
if [ ! -d $sampleSamseOutDir ]; then
mkdir $sampleSamseOutDir
fi
for((i=0;i<$sizeFile;i++)); do
lfile=${lfilelist[i]}
#rfile=${rfilelist[i]}
echo processing $lfile
#dice=`roll_die $numOKNodes`
#dice=`expr $dice - 1`
#echo dice $dice ${okNodes[dice]}
header="#!/bin/bash"
commandAlnL="bwa aln -n $ALN_N -o $ALN_o -e $ALN_e -d $ALN_d -i $ALN_i $ALN_l_FLAG -k $ALN_k -t $ALN_t -M $ALN_M -O $ALN_O -E $ALN_E $ALN_R_FLAG $ALN_c_FLAG $ALN_N_FLAG -q $ALN_q $genome $fastqDir/${lfile} > $saiDir/${lfile/.fastq/.sai} 2> $saiDir/${lfile/.fastq/.err}; echo done >> $saiDir/${lfile/.fastq/.err};"
commandSamseL="bwa samse -n $SAMSE_n $genome $saiDir/${lfile/.fastq/.sai} $fastqDir/${lfile} > $sampleSamseOutDir/${lfile/.fastq/.sam} 2> $sampleSamseOutDir/${lfile/.fastq/.stderr}; echo done >> $sampleSamseOutDir/${lfile/.fastq/.stderr};"
if [ ! -d $configDir/queuejobs ]; then
mkdir $configDir/queuejobs
fi
tmpshName=$configDir/queuejobs/bwa_sub_${lfile/.fastq/}.sh
echo $header > $tmpshName
echo "#$tmpshName" >> $tmpshName
echo "source ~/.bashrc" >> $tmpshName
echo $commandAlnL >> $tmpshName
echo $commandSamseL >> $tmpshName
cat $tmpshName
#qsubcommand="qsub -e $queueJobStdWritePath/$sample.bwa.err -m a -M $queueJobEmail -o queueJobStdWritePath/$sample.bwa.out $tmpshName"
bsubcommand="bsub bash $tmpshName"
echo $bsubcommand
eval $bsubcommand
done
IFS=$saveIFS
done
exit;
command="echo 'source ~/.bashrc; bwa index $indexFlag $genome > $logprefix/$genomeName.bwa_index.stdout 2> $logprefix/$genomeName.bwa_index.stderr' | qsub -l nodes=$nodehostname -q $jobQueue -m a -M $queueJobEmail -"
echo $command
eval $command