annotate bsmap_wrapper.sh @ 5:98a0a60e934c draft

Uploaded
author eiriche
date Thu, 29 Nov 2012 10:10:55 -0500
parents 91e88de226a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
1 #!/bin/bash
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
2 #
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
3 # Galaxy wrapper for BSMAP
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
4 # Written by Eugen Eirich @ Institute for Molecular Biology Mainz
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
5 #
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
6
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
7 set -e
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
8
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
9 #get parameters
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
10
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
11 until [ $# -eq 0 ]
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
12 do
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
13 case $1 in
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
14 ref=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
15 ref=${1#ref=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
16 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
17 library=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
18 library=${1#library=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
19 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
20 unpaired=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
21 unpaired=${1#unpaired=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
22 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
23 mapped=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
24 mapped=${1#mapped=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
25 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
26 fullparam=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
27 fullparam=${1#fullparam=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
28 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
29 mate1=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
30 mate1=${1#mate1=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
31 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
32 mate2=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
33 mate2=${1#mate2=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
34 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
35 qual=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
36 qual="-z ${1#qual=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
37 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
38 threshold=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
39 threshold="-q ${1#threshold=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
40 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
41 lowqual=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
42 lowqual="-f ${1#lowqual=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
43 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
44 adapter=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
45 adapter=${1#adapter=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
46 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
47 firstn=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
48 firstn="-L ${1#firstn=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
49 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
50 repeat_reads=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
51 repeat_reads="-r ${1#repeat_reads=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
52 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
53 seed_size=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
54 seed_size="-s ${1#seed_size=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
55 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
56 mismatch=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
57 mismatch="-v ${1#mismatch=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
58 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
59 equal_best=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
60 equal_best="-w ${1#equal_best=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
61 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
62 start=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
63 start="-B ${1#start=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
64 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
65 end=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
66 end="-E ${1#end=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
67 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
68 index_interval=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
69 index_interval="-I ${1#index_interval=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
70 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
71 seed_random=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
72 seed_random=${1#seed_random=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
73 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
74 rrbs=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
75 rrbs=${1#rrbs=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
76 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
77 mode=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
78 mode="-n ${1#mode=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
79 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
80 align_info=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
81 align_info=${1#align_info=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
82 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
83 maxinsert=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
84 maxinsert="-x ${1#maxinsert=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
85 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
86 mininsert=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
87 mininsert="-m ${1#mininsert=}"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
88 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
89 summary=*)
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
90 summary=${1#summary=}
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
91 ;;
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
92 esac
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
93 shift
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
94 done
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
95
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
96
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
97 if [ "$rrbs" != "" ]
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
98 then
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
99 rrbs="-D $rrbs"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
100 fi
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
101
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
102 if [ "$align_info" != "" ]
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
103 then
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
104 align_info="-M $align_info"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
105 fi
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
106
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
107 if [ "$adapter" != "" ]
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
108 then
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
109 adapter="-A $adapter"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
110 fi
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
111
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
112 if [ "$seed_random" != "" ]
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
113 then
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
114 seed_random="-S $seed_random"
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
115 fi
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
116
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
117
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
118 if [ "$library" == "single" ]
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
119 then
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
120 if [ "$fullparam" == 'false' ]
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
121 then
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
122 bsmap -a $mate1 -d $ref -o $mapped -R -r 0 -p 4 > $summary
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
123 else
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
124 bsmap -a $mate1 -d $ref -o $mapped -R -r 0 -p 4 $qual $threshold $lowqual $adapter $firstn $repeat_reads $seed_size $mismatch $equal_best $start $end $index_interval $mode > $summary
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
125 fi
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
126 else
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
127 if [ "$fullparam" == 'false' ]
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
128 then
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
129 bsmap -a $mate1 -b $mate2 -2 $unpaired -d $ref -o $mapped -R -r 0 -p 4 > $summary
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
130 else
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
131 bsmap -a $mate1 -b $mate2 -2 $unpaired -d $ref -o $mapped -R -r 0 -p 4 $qual $threshold $lowqual $adapter $firstn $repeat_reads $seed_size $mismatch $equal_best $start $end $index_interval $mode $maxinsert $mininsert > $summary
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
132 fi
91e88de226a3 Uploaded
eiriche
parents:
diff changeset
133 fi