comparison bismark_wrapper.sh @ 13:ee3bd6ad3958 draft

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