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