0
|
1 #!/bin/bash
|
|
2 #
|
|
3 # Galaxy wrapper for Bismark
|
|
4 #
|
|
5
|
|
6 set -e
|
|
7
|
|
8 export PATH="/home/galaxy/dependencies/bismark:$PATH"
|
|
9 export PATH="/home/galaxy/dependencies/diverse:$PATH"
|
|
10
|
|
11 #get parameters
|
|
12
|
|
13 until [ $# -eq 0 ]
|
|
14 do
|
|
15 case $1 in
|
|
16 ref=*)
|
|
17 ref=${1#ref=}
|
|
18 ;;
|
|
19 library=*)
|
|
20 library=${1#library=}
|
|
21 ;;
|
|
22 fullparam=*)
|
|
23 fullparam=${1#fullparam=}
|
|
24 ;;
|
|
25 mate1=*)
|
|
26 mate1=${1#mate1=}
|
|
27 ;;
|
|
28 mate2=*)
|
|
29 mate2=${1#mate2=}
|
|
30 ;;
|
|
31 qual=*)
|
|
32 qual=${1#qual=}
|
|
33 ;;
|
|
34 seedmms=*)
|
|
35 seedmms="--seedmms ${1#seedmms=}"
|
|
36 ;;
|
|
37 seedlen=*)
|
|
38 seedlen="--seedlen ${1#seedlen=}"
|
|
39 ;;
|
|
40 maqerr=*)
|
|
41 maqerr="--maqerr ${1#maqerr=}"
|
|
42 ;;
|
|
43 directional=*)
|
|
44 directional=${1#directional=}
|
|
45 ;;
|
|
46 header=*)
|
|
47 header=${1#header=}
|
|
48 ;;
|
|
49 minins=*)
|
|
50 minins="--minins ${1#minins=}"
|
|
51 ;;
|
|
52 maxins=*)
|
|
53 maxins="--maxins ${1#maxins=}"
|
|
54 ;;
|
|
55 mapped=*)
|
|
56 mapped=${1#mapped=}
|
|
57 ;;
|
|
58 summary=*)
|
|
59 summary=${1#summary=}
|
|
60 ;;
|
|
61 tempdir=*)
|
|
62 tempdir=${1#tempdir=}
|
|
63 ;;
|
|
64 esac
|
|
65 shift
|
|
66 done
|
|
67
|
|
68
|
|
69 if [ "$library" == "single" ]
|
|
70 then
|
|
71 if [ "$fullparam" == 'false' ]
|
|
72 then
|
|
73 bismark --output_dir $tempdir --temp_dir $tempdir --quiet $ref $mate1 2>&1 > /dev/null
|
|
74 else
|
|
75 bismark --output_dir $tempdir --temp_dir $tempdir --quiet $qual $seedmms $seedlen $maqerr $directional $header $ref $mate1 2>&1 > /dev/null
|
|
76 fi
|
|
77 else
|
|
78 if [ "$fullparam" == 'false' ]
|
|
79 then
|
|
80 bismark --output_dir $tempdir --temp_dir $tempdir --quiet $ref -1 $mate1 -2 $mate2 2>&1 > /dev/null
|
|
81 else
|
|
82 bismark --output_dir $tempdir --temp_dir $tempdir --quiet $qual $seedmms $seedlen $maqerr $directional $header $minins $maxins $ref -1 $mate1 -2 $mate2 2>&1 > /dev/null
|
|
83 fi
|
|
84 fi
|
|
85
|
|
86
|
|
87 #call bismark. output in temp-directory (files_path)
|
|
88
|
|
89
|
|
90 #parse the filename of the input -> same as output
|
|
91 IFS="/"
|
|
92 set - $mate1
|
|
93 outfile=${*:$#:1}
|
|
94
|
|
95 #sort the mapped reads by chromosome
|
|
96 #sort -k 3,3 -k 4,4n "$tempdir/${outfile}_bismark_pe.sam" > "$tempdir/${outfile}_bismark_pe_sorted.sam"
|
|
97
|
|
98 #copy resultfiles back into galaxy
|
|
99 #cp "$tempdir/${outfile}_bismark_sorted.sam" "$mapped"
|
|
100 if [ "$library" == "single" ]
|
|
101 then
|
|
102 cp "$tempdir/${outfile}_bismark.sam" "$mapped"
|
|
103 cp "$tempdir/${outfile}_Bismark_mapping_report.txt" "$summary"
|
|
104 else
|
|
105 cp "$tempdir/${outfile}_bismark_pe.sam" "$mapped"
|
|
106 cp "$tempdir/${outfile}_Bismark_paired-end_mapping_report.txt" "$summary"
|
|
107 fi
|
|
108
|
|
109
|
|
110
|
|
111
|
|
112
|
|
113
|
|
114
|