Mercurial > repos > saskia-hiltemann > ireport
annotate createHTML.sh @ 9:7300ed4c1481 draft default tip
Uploaded
author | saskia-hiltemann |
---|---|
date | Mon, 04 Sep 2017 10:49:00 -0400 |
parents | 42076db43d42 |
children |
rev | line source |
---|---|
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
1 gbcount=0 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
2 |
4 | 3 ## |
4 ## Create Cover Page | |
5 ## | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
6 #<a href=\"$zipireport\"> Click here to download a copy of this iReport </a> <br/><br/> |
0 | 7 function makeIntroPage ( ){ |
8 echo "Creating Intro Page" | |
9 title="$1" | |
10 coverimage=$2 | |
11 link=$3 | |
12 htmlout=$4 | |
1 | 13 zipireport=$5 |
0 | 14 |
15 echo -e "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"> | |
16 <html> | |
17 <head> | |
18 </head> | |
19 <body> | |
20 <br/> | |
21 <br/> | |
22 <center> | |
23 <b><font size=\"15\"> iReport: ${title} </font></b><br/> | |
24 <br/> | |
25 <br/> | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
26 <a href=\"$link\"> Click image to view report </a> <br/><br/> |
0 | 27 <a href=\"$link\"> <img src="$coverimage" width=\"50%\" alt=\"loading image..\"/> </a><br/><br/> |
28 </center> | |
29 </body> | |
30 </html>" > $htmlout | |
31 | |
32 } | |
33 | |
4 | 34 ## |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
35 ## Decompress archive fiels |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
36 ## -> will detect archive formats: zip, tar, gzip, tar.gz, bzip2 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
37 ## -> input: path to archive |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
38 ## -> files will be located in ${galaxypath}/archive_${fname}/ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
39 ## |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
40 function decompressArchive (){ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
41 archive=$1 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
42 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
43 fname=`basename ${archive}` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
44 fname=${fname%.dat} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
45 ftype=`file $archive` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
46 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
47 if [[ ! -d ${galaxypath}/archive_${fname}/ ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
48 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
49 mkdir ${galaxypath}/archive_${fname}/ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
50 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
51 #echo "archive type: `file $archive`" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
52 # decompress archive |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
53 if [[ $ftype == *Zip* ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
54 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
55 #echo "detected zip file" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
56 cp $archive ${galaxypath}/archive_${fname}/${fname}.zip |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
57 wd=`pwd` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
58 cd ${galaxypath}/archive_${fname}/ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
59 unzip -q ${fname}.zip |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
60 rm ${fname}.zip |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
61 cd $wd |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
62 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
63 if [[ $ftype == *tar* ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
64 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
65 cp $archive ${galaxypath}/archive_${fname}/${fname}.tar |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
66 wd=`pwd` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
67 cd ${galaxypath}/archive_${fname}/ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
68 tar xf ${fname}.tar |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
69 rm ${fname}.tar |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
70 cd $wd |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
71 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
72 if [[ $ftype == *gzip* ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
73 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
74 cp $archive ${galaxypath}/archive_${fname}/${fname}.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
75 gunzip ${galaxypath}/archive_${fname}/${fname}.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
76 #ls ${galaxypath}/archive_${fname}/ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
77 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
78 # check for tar.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
79 ftype=`file ${galaxypath}/archive_${fname}/${fname}` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
80 if [[ $ftype == *tar* ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
81 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
82 # turns out it was tar.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
83 rm -Rf ${galaxypath}/archive_${fname}/* |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
84 ls ${galaxypath}/archive_${fname}/ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
85 cp $archive ${galaxypath}/archive_${fname}/${fname}.tar.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
86 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
87 wd=`pwd` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
88 cd ${galaxypath}/archive_${fname}/ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
89 tar xzf ${fname}.tar.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
90 cd $wd |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
91 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
92 wait |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
93 rm -f ${galaxypath}/archive_${fname}/*.tar |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
94 rm -f ${galaxypath}/archive_${fname}/*.tar.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
95 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
96 if [[ $ftype == *bzip2* ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
97 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
98 cp $archive ${galaxypath}/archive_${fname}/${fname}.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
99 gunzip2 ${galaxypath}/archive_${fname}/${fname}.gz |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
100 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
101 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
102 } |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
103 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
104 ## |
4 | 105 ## Create HTML content for the tabs specified by user |
106 ## | |
0 | 107 function makeTabContent ( ){ |
4 | 108 tab=$1 # name of current tab |
109 itemslist=$2 # list of all items | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
110 tracklist=$3 # genome browser tracks info |
4 | 111 contentline="" # HTML code for tab |
112 imgcount=0 # keep track of the number of images on the current tab | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
113 iframename=`head -n 1 < /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
114 #iframename="test" |
0 | 115 for item in $itemslist |
116 do | |
4 | 117 ## Parse items lists |
0 | 118 item=${item/::/:emptycol:} |
119 declare -a myarr=(`echo $item |sed 's/:/ /g'`) | |
4 | 120 |
121 ## Create the tab contents HTML code | |
0 | 122 if [ ${myarr[0]} == $tab ] |
123 then | |
124 | |
4 | 125 ## |
126 ## Text Field | |
127 ## | |
0 | 128 if [ ${myarr[1]} == "text" ] |
129 then | |
130 text=${myarr[2]} | |
4 | 131 md=${myarr[4]} |
0 | 132 |
4 | 133 # if markdown, convert to html |
134 if [ $md == "Y" ] | |
135 then | |
136 ## resubstitute sanitized charachters | |
137 text=${text//==space==/ } | |
138 text=${text//==colon==/:} | |
139 text=${text//==comma==/,} | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
140 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
141 text=${text//==braceopen==/(} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
142 text=${text//==braceclose==/)} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
143 text=${text//==cbraceopen==/{} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
144 text=${text//==cbraceclose==/}} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
145 |
4 | 146 text=${text//==slash==/\/} |
147 text=${text//==lt==/<} | |
148 text=${text//==gt==/>} | |
149 text=${text//==apos==/\'} | |
150 text=${text//==quote==/\"} | |
151 text=${text//==backtick==/\`} | |
152 text=${text//==dollar==/$} | |
153 text=${text//==bar==/|} | |
154 text=${text//&&/&} | |
155 text=${text//\\n/\\n} | |
156 text=${text//\\t/\\t} | |
157 text=${text//\&r\&n/\\n} | |
158 text=${text//\&r/\\n} | |
159 text=${text//\&n/\\n} | |
160 text=${text//\&c/:} | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
161 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
162 |
4 | 163 ## convert markdown in textfield to html |
164 echo -e "$text" > mytext.md | |
165 | |
166 if [ -z `type -p pandoc` ] | |
167 then | |
168 # pandoc missing | |
169 ${repositorypath}/Markdown/markdown2.py mytext.md > mytext.html | |
170 | |
171 else | |
172 # pandoc exists | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
173 pandoc -f markdown -o mytext.html mytext.md |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
174 pandoc -f markdown -o standalone.html -s mytext.md |
4 | 175 |
176 #get css generated by pandoc and add as scoped attribute (HTML5) | |
177 pandocstyle=`sed -n '/<style/,/style>/p' standalone.html` | |
178 fi | |
179 | |
180 markdowntext=$(cat mytext.html) | |
181 contentline="${contentline}\n<div class=\"markdown-body\">${pandocstyle} ${markdowntext}</div>\n" | |
182 | |
183 else # If not markdown, print verbatim (with exception of few html tags) | |
0 | 184 |
4 | 185 ## allow some html formatting tags |
186 text=${text//==lt==strong==gt==/<strong>} # search for strong tags | |
187 text=${text//==lt====slash==strong==gt==/<\/strong>} # search for strong tags | |
188 text=${text//==lt==em==gt==/<em>} # search for strong tags | |
189 text=${text//==lt====slash==em==gt==/<\/em>} # search for strong tags | |
190 | |
191 text=${text//==lt==b==gt==/<strong>} # search for strong tags | |
192 text=${text//==lt====slash==b==gt==/<\/strong>} # search for strong tags | |
193 text=${text//==lt==i==gt==/<em>} # search for strong tags | |
194 text=${text//==lt====slash==i==gt==/<\/em>} # search for strong tags | |
195 | |
196 text=${text//==lt==br==gt==/<br\/>} # search for strong tags | |
197 text=${text//==lt====br==slash==gt==/<br\/>} # search for strong tags | |
198 text=${text//==lt==h1==gt==/<h1>} # search for h1-h6 tags | |
199 text=${text//==lt==h2==gt==/<h2>} # search for h1-h6 tags | |
200 text=${text//==lt==h3==gt==/<h3>} # search for h1-h6 tags | |
201 text=${text//==lt==h4==gt==/<h4>} # search for h1-h6 tags | |
202 text=${text//==lt==h5==gt==/<h5>} # search for h1-h6 tags | |
203 text=${text//==lt==h6==gt==/<h6>} # search for h1-h6 tags | |
204 text=${text//==lt====slash==h1==gt==/<\/h1>} # search for h1-h6 closing tags | |
205 text=${text//==lt====slash==h2==gt==/<\/h2>} # search for h1-h6 closing tags | |
206 text=${text//==lt====slash==h3==gt==/<\/h3>} # search for h1-h6 closing tags | |
207 text=${text//==lt====slash==h4==gt==/<\/h4>} # search for h1-h6 closing tags | |
208 text=${text//==lt====slash==h5==gt==/<\/h5>} # search for h1-h6 closing tags | |
209 text=${text//==lt====slaxh==h6==gt==/<\/h6>} # search for h1-h6 closing tags | |
210 | |
211 ## display everything else verbatim | |
212 text=${text//==space==/ } | |
213 text=${text//==colon==/:} | |
214 text=${text//==comma==/,} | |
215 text=${text//==slash==/\/} | |
216 text=${text//==lt==/<} | |
217 text=${text//==gt==/>} | |
218 text=${text//==apos==/'} | |
219 text=${text//==quote==/"} | |
220 text=${text//&&/&} | |
221 text=${text//\\n/<br/>} | |
222 text=${text//\\t/ } | |
223 text=${text//\&r\&n/<br/>} | |
224 text=${text//\&r/<br/>} | |
225 text=${text//\&n/<br/>} | |
226 text=${text//\&c/:} | |
227 text=${text//==backtick==/`} | |
228 text=${text//==dollar==/$} | |
229 text=${text//==bar==/|} | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
230 text=${text//==braceopen==/(} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
231 text=${text//==braceclose==/)} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
232 text=${text//==cbraceopen==/{} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
233 text=${text//==cbraceclose==/}} |
4 | 234 contentline="${contentline}\n${text}\n" |
235 fi | |
0 | 236 |
4 | 237 |
0 | 238 fi |
239 | |
4 | 240 ## |
241 ## Text File | |
242 ## | |
0 | 243 if [ ${myarr[1]} == "textfile" ] |
244 then | |
245 tfile=${myarr[2]} | |
4 | 246 md=${myarr[4]} |
0 | 247 fname=`basename ${tfile}` |
248 fname=${fname%.*} | |
249 fname="${fname}.txt" | |
250 cp ${tfile} "${galaxypath}/${fname}" | |
251 | |
252 #estimate height for iframe based on number oflines in the file | |
253 numlines=`wc -l ${tfile} | cut -d" " -f1` | |
254 minheight=$[$numlines*17] | |
255 | |
4 | 256 # if markdown, convert to html |
257 if [ $md == "Y" ] | |
258 then | |
259 | |
260 if [ -z `type -p pandoc` ] | |
261 then | |
262 # pandoc missing | |
263 ${repositorypath}/Markdown/markdown2.py ${tfile} > mytext.html | |
264 | |
265 else | |
266 # pandoc exists | |
267 pandoc -o mytext.html ${tfile} | |
268 pandoc -o standalone.html -s ${tfile} | |
269 | |
270 # get css generated by pandoc and add as scoped attribute (HTML5) | |
271 pandocstyle=`sed -n '/<style/,/style>/p' standalone.html` | |
272 | |
273 fi | |
274 | |
275 markdowntext=$(cat mytext.html) | |
276 contentline="${contentline}\n<div class=\"markdown-body\">${pandocstyle} ${markdowntext}</div>\n" | |
277 else | |
278 contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${fname}\" width=\"100%\" height=\"$minheight\"> </iframe>\n" | |
279 fi | |
0 | 280 fi |
281 | |
4 | 282 ## |
283 ## Image | |
284 ## | |
0 | 285 if [ ${myarr[1]} == "image" ] |
4 | 286 |
0 | 287 then |
288 imgcount=$[$imgcount+1] | |
289 #restore file suffix for html | |
290 ftype=`file ${myarr[2]}` | |
291 zoomlevel=${myarr[4]} | |
292 zoomenable=${myarr[5]} | |
293 align=${myarr[6]} | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
294 typestring="" |
0 | 295 #####echo "zoomenable:${zoomenable}, align:${align}" |
296 if [[ $ftype == *JPEG* ]] | |
297 then | |
298 suffix=".jpg" | |
299 fi | |
300 if [[ $ftype == *SVG* ]] | |
301 then | |
302 suffix=".svg" | |
303 fi | |
304 if [[ $ftype == *PNG* ]] | |
305 then | |
306 suffix=".png" | |
307 fi | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
308 if [[ $ftype == *TIFF* ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
309 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
310 suffix=".tiff" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
311 typestring="type=\"image/tiff\"" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
312 fi |
0 | 313 |
314 image=`basename ${myarr[2]}` | |
315 image=${image%.dat} | |
316 image="${image}${suffix}" | |
317 cp ${myarr[2]} ${galaxypath}/${image} | |
318 | |
319 if [[ ${align} == "none" ]] | |
320 then | |
321 alignstring="" | |
322 alignstring2="" | |
323 else | |
324 alignstring="<div float=\"${align}\">" | |
325 alignstring2="</div>" | |
326 | |
327 alignstring="align=\"${align}\"" | |
328 alignstring2="" | |
329 fi | |
330 | |
331 | |
332 if [[ ${zoomlevel} -eq 0 ]] | |
333 then | |
334 widthstring="" | |
335 else | |
336 widthstring="width=\"${zoomlevel}\"" | |
337 fi | |
338 | |
339 if [[ ${zoomlevel} -eq 0 || ${zoomenable} == "N" ]] | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
340 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
341 contentline="${contentline}<span id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>" |
0 | 342 else |
343 contentline="${contentline}<span class=\"zoomme\" id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>" | |
344 fi | |
345 | |
346 fi | |
4 | 347 |
348 ## | |
349 ## Table | |
350 ## | |
0 | 351 if [ ${myarr[1]} == "table" ] |
352 then | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
353 |
0 | 354 maxlines=50000 |
355 tsvfile_orig=${myarr[2]} | |
356 tsvfile="tablehead.tsv" | |
357 fname=`basename ${tsvfile_orig}` | |
358 fname=${fname%.*} | |
359 fancy=${myarr[4]} | |
360 makelinks=${myarr[5]} | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
361 #iframeid="iframe$giframecount" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
362 iframeid="iframe-$iframename" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
363 |
0 | 364 #echo "\nmakelinks: $makelinks fancy: $fancy <br>" |
365 | |
366 #TODO client side database for large files. For now only display first section of file and add download link | |
367 numlines=`wc -l ${tsvfile_orig} |cut -d" " -f1` | |
368 | |
369 head -${maxlines} ${tsvfile_orig} > tsvtmpfile | |
370 | |
371 #remove any empty or header lines (lines starting with #, unless vcf file, then keep #CHROM line) | |
372 awk 'BEGIN{ | |
373 FS="\t" | |
374 OFS="\t" | |
375 }{ | |
376 if((index($0,"#")==1 && index($0,"#CHROM")!=1) || $0==""){ | |
377 headerlines++ | |
378 } | |
379 else print $0 | |
380 | |
381 }END{}' tsvtmpfile > ${tsvfile} | |
382 | |
383 if [[ $makelinks == "Y" ]] | |
384 then | |
385 col=${myarr[6]} | |
386 prefix=${myarr[7]} | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
387 suffix=${myarr[8]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
388 urlitems=${myarr[9]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
389 minw=${myarr[10]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
390 minh=${myarr[11]} |
0 | 391 suffix=${suffix/emptycol/} |
392 suffix=${suffix/==quote==/&} | |
393 prefix=${prefix/emptycol/} | |
394 prefix=${prefix/==quote==/&} | |
395 prefix=${prefix/==colon==/:} | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
396 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
397 # unpack archive of files to link to if present |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
398 if [[ ${urlitems} != None ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
399 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
400 oldfname=$fname |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
401 decompressArchive ${urlitems} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
402 prefix=archive_${fname}/${prefix} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
403 fname=$oldfname |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
404 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
405 |
0 | 406 |
407 #edit the table to include links | |
408 awk 'BEGIN{ | |
409 FS="\t" | |
410 OFS="\t" | |
411 url="'"$prefix"'" | |
412 url2="'"$suffix"'" | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
413 iframeid="'"$iframeid"'" |
0 | 414 prefix="<a href=\42" |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
415 suffix="\42 onclick=\42resizeIframe("iframeid")\42>" |
0 | 416 col="'"$col"'" |
417 end="</a>" | |
418 }{ | |
419 if(FNR==1) | |
420 print $0 | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
421 else{ |
0 | 422 $col=prefix""url""$col""url2""suffix""$col""end |
423 print $0 | |
424 } | |
425 }END{}' ${tsvfile} > ${tsvfile}2 | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
426 |
0 | 427 else |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
428 minw=${myarr[6]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
429 minh=${myarr[7]} |
0 | 430 cp ${tsvfile} ${tsvfile}2 |
431 fi | |
432 | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
433 #iframecount=$[$iframecount+1] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
434 |
0 | 435 if [ $fancy == "Y" ] |
436 then | |
437 perl ${repositorypath}/tsv2html.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
438 contentline="${contentline}\n<iframe class=\"invisibleframe fancyiframe\" id=\"$iframeid\" src=\"htmltable_${fname}.html\" width=\"100%\" style=\"height: 350px; min-height: ${minh}px !important; overflow-y: hidden; overflow-x: scroll\" onClick=resizeIframe(\"$iframeid\")></iframe>" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
439 |
0 | 440 else |
441 perl ${repositorypath}/tsv2html_simple.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
442 contentline="${contentline}\n<iframe class=\"unfancyiframe invisibleframe\" id=\"$iframeid\" src=\"htmltable_${fname}.html\" scrolling=\"no\" style=\"min-width: ${minw}px; min-height: ${minh}px !important; max-width: 100%; vertical-align: top;\" onClick=resizeIframe(\"$iframeid\") ></iframe>" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
443 |
0 | 444 fi |
445 | |
446 if [[ $numlines -gt ${maxlines} ]] | |
447 then | |
448 tablename=`basename ${tsvfile_orig}` | |
449 cp ${tsvfile_orig} ${galaxypath}/$tablename | |
450 contentline="${contentline}<br/>\nLarge tables will be supported soon. The first ${maxlines} lines are shown here, and you can download the full file <a href=\"${tablename}\">here</a>." | |
451 fi | |
452 fi | |
453 | |
4 | 454 ## |
455 ## PDF | |
456 ## | |
0 | 457 if [[ ${myarr[1]} == "pdf" ]] |
458 then | |
459 pdffile=${myarr[2]} | |
460 fname=`basename ${pdffile}` | |
461 fname=${fname%.dat} | |
462 pdfname="${fname}.pdf" | |
463 cp ${pdffile} "${galaxypath}/${pdfname}" | |
464 | |
465 width=1000 | |
466 height=800 | |
467 echo -e "<html><body><object data=\"${pdfname}\" type=\"application/pdf\" width=\"$width\" height=\"$height\"><embed src=\"${pdfname}\" type=\"application/pdf\" /><p>It appears you have no PDF plugin for your browser. No biggie... you can <a href=\"${pdfname}\">click here to download the PDF file.</a></p></object></body></html>" > "${galaxypath}/${fname}.html" | |
468 width=$[$width+10] | |
469 height=$[$height+10] | |
4 | 470 contentline="${contentline}\n<iframe src=\"${fname}.html\" width=\"${width}\" height=\"${height}\"></iframe>\n" |
0 | 471 |
472 fi | |
4 | 473 |
474 ## | |
475 ## HTML | |
476 ## | |
477 if [[ ${myarr[1]} == "htmlfile" ]] | |
478 then | |
479 htmlfile=${myarr[2]} | |
480 height=${myarr[4]} | |
481 fname=`basename ${htmlfile}` | |
482 fname=${fname%.dat} | |
483 htmlname="${fname}.html" | |
484 cp ${htmlfile} "${galaxypath}/${htmlname}" | |
485 | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
486 apiid=${myarr[5]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
487 isireport=${myarr[6]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
488 localhost=${myarr[7]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
489 proxy=${myarr[8]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
490 localhost=${localhost//==colon==/:} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
491 localhost=${localhost//==fslash==/\/} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
492 if [[ ${isireport} == "Y" ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
493 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
494 #cp ${localhost}/datasets/${apiid}/* "${galaxypath}/tst" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
495 htmlname="/${proxy}/datasets/${apiid}/display/" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
496 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
497 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
498 contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${htmlname}\" width=\"100%\" height=\"${height}px\"></iframe>\n" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
499 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
500 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
501 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
502 if [[ ${myarr[1]} == "htmlpage" ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
503 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
504 url=${myarr[2]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
505 url=${url//==colon==/:} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
506 url=${url//==fslash==//} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
507 height=${myarr[4]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
508 contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${url}\" width=\"100%\" height=\"${height}px\"></iframe>\n" |
4 | 509 fi |
510 | |
511 ## | |
512 ## Web Link | |
513 ## | |
0 | 514 if [ ${myarr[1]} == "weblink" ] |
515 then | |
516 url=${myarr[2]} | |
517 linktext=${myarr[4]} | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
518 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
519 echo -n "$url" > tmpfileb64 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
520 url=`base64 -d tmpfileb64` |
0 | 521 |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
522 echo -n "$linktext" > tmpfileb64 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
523 linktext=`base64 -d tmpfileb64` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
524 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
525 if [[ -z $linktext ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
526 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
527 linktext=$url |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
528 fi |
0 | 529 contentline="${contentline}<a href=\"${url}\" target=\"_blank\">${linktext}</a>" |
530 fi | |
531 | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
532 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
533 ## |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
534 ## Genome Browser |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
535 ## |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
536 if [ ${myarr[1]} == "genomebrowser" ] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
537 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
538 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
539 # parse inputs |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
540 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
541 apiid=${myarr[4]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
542 servername=${myarr[5]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
543 buildver=${myarr[2]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
544 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
545 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
546 region=${myarr[6]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
547 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
548 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
549 echo -n "$region" > tmpfileb64 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
550 region=`base64 -d tmpfileb64` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
551 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
552 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
553 initialchrom=${region%:*} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
554 initialrange=${region#*:} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
555 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
556 initialstart=${initialrange%-*} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
557 initialend=${initialrange#*-} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
558 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
559 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
560 #TODO |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
561 ftype="vcf" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
562 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
563 servername=${servername/==colon==/:} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
564 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
565 ## parse and prepare all tracks |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
566 gbcount=$[$gbcount+1] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
567 gbfilelist=${tracklist} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
568 userTracks="" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
569 #IFS=',' read -a gbfilearray <<< ${gbfilelist} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
570 gbfilearray=(${gbfilelist//,/ }) |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
571 for gbfile in "${gbfilearray[@]}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
572 do |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
573 # gbfile is in format "browsernum:file" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
574 #IFS=':' read -a gbfileinfo <<< ${gbfile} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
575 gbfileinfo=(${gbfile//:/ }) |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
576 if [[ ${gbfileinfo[0]} == $gbcount ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
577 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
578 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
579 ftype=${gbfileinfo[3]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
580 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
581 gbfilename=${gbfileinfo[1]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
582 gbfilelabel=${gbfileinfo[2]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
583 gbfilelabel=${gbfilelabel//==space==/ } |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
584 gbfilelabel=${gbfilelabel//==bopen==/(} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
585 gbfilelabel=${gbfilelabel//==bclose==/)} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
586 fname=`basename ${gbfilename}` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
587 fname=${fname%.dat} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
588 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
589 if [[ $ftype == "vcftabix" ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
590 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
591 newgbfilename="${fname}.vcf" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
592 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
593 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
594 cp ${gbfilename} "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
595 bgzip "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
596 tabix -f -p vcf "${galaxypath}/${newgbfilename}.gz" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
597 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
598 userTracks="${userTracks}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
599 {name: '${gbfilelabel}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
600 uri: '${servername}/datasets/${apiid}/display/${newgbfilename}.gz', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
601 tier_type: 'tabix', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
602 payload: 'vcf'} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
603 " |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
604 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
605 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
606 if [[ $ftype == "vcfmemstore" ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
607 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
608 newgbfilename="${fname}.vcf" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
609 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
610 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
611 cp ${gbfilename} "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
612 #bgzip "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
613 #tabix -p vcf "${galaxypath}/${newgbfilename}.gz" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
614 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
615 userTracks="${userTracks}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
616 {name: '${gbfilelabel}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
617 uri: '${servername}/datasets/${apiid}/display/${newgbfilename}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
618 tier_type: 'memstore', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
619 payload: 'vcf'} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
620 " |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
621 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
622 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
623 if [[ $ftype == "bam" ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
624 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
625 newgbfilename="${fname}.bam" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
626 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
627 # link to bam instead of copying |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
628 ln -s ${gbfilename} "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
629 samtools index "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
630 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
631 userTracks="${userTracks}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
632 {name: '${gbfilelabel}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
633 bamURI: '${servername}/datasets/${apiid}/display/${newgbfilename}'} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
634 " |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
635 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
636 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
637 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
638 if [[ $ftype == "bigbed" ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
639 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
640 newgbfilename="${fname}.bigbed" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
641 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
642 cp ${gbfilename} "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
643 #bgzip "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
644 #tabix -f -p bed "${galaxypath}/${newgbfilename}.gz" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
645 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
646 userTracks="${userTracks}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
647 {name: '${gbfilelabel}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
648 bwgURI: '${servername}/datasets/${apiid}/display/${newgbfilename}'} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
649 " |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
650 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
651 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
652 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
653 if [[ $ftype == "bedtabix" ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
654 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
655 newgbfilename="${fname}.bed" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
656 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
657 cp ${gbfilename} "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
658 bgzip "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
659 tabix -f -p bed "${galaxypath}/${newgbfilename}.gz" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
660 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
661 userTracks="${userTracks}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
662 {name: '${gbfilelabel}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
663 uri: '${servername}/datasets/${apiid}/display/${newgbfilename}.gz', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
664 tier_type: 'tabix', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
665 payload: 'bed'} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
666 " |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
667 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
668 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
669 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
670 if [[ $ftype == "bedmemstore" ]] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
671 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
672 newgbfilename="${fname}.bed" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
673 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
674 cp ${gbfilename} "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
675 #bgzip "${galaxypath}/${newgbfilename}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
676 #tabix -p bed "${galaxypath}/${newgbfilename}.gz" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
677 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
678 userTracks="${userTracks}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
679 {name: '${gbfilelabel}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
680 uri: '${servername}/datasets/${apiid}/display/${newgbfilename}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
681 tier_type: 'memstore', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
682 payload: 'bed'} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
683 " |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
684 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
685 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
686 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
687 done |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
688 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
689 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
690 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
691 if [ ${buildver} == "hg18" ] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
692 then |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
693 coordSystem="coordSystem: { |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
694 speciesName: 'Human', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
695 taxon: 9606, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
696 auth: 'NCBI', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
697 version: '36', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
698 ucscName: 'hg18' |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
699 }," |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
700 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
701 chains="chains: { |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
702 hg19ToHg18: new Chainset('https://www.biodalliance.org/das/hg19ToHg18/', 'GRCh37', 'NCBI36', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
703 { |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
704 speciesName: 'Human', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
705 taxon: 9606, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
706 auth: 'GRCh', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
707 version: 37 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
708 }) |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
709 }," |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
710 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
711 genesTrack="{name: 'Genes', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
712 desc: 'Gene structures from Ensembl 54', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
713 uri: 'https://www.biodalliance.org/das/hsa_54_36p/', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
714 collapseSuperGroups: true, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
715 provides_karyotype: true, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
716 provides_search: true, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
717 provides_entrypoints: true, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
718 maxbins: false}, " |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
719 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
720 repeatsTrack="{name: 'Repeats', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
721 desc: 'Repeat annotation from Ensembl 59', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
722 bwgURI: 'https://www.biodalliance.org/datasets/repeats.bb', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
723 stylesheet_uri: 'https://www.biodalliance.org/stylesheets/bb-repeats.xml'}" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
724 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
725 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
726 # default is hg19 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
727 else |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
728 coordSystem="coordSystem: { |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
729 speciesName: 'Human', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
730 taxon: 9606, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
731 auth: 'NCBI', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
732 version: '37', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
733 ucscName: 'hg19' |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
734 }," |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
735 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
736 chains="" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
737 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
738 genesTrack="{name: 'Genes', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
739 desc: 'Gene structures from GENCODE 19', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
740 bwgURI: 'https://www.biodalliance.org/datasets/gencode.bb', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
741 stylesheet_uri: 'https://www.biodalliance.org/stylesheets/gencode.xml', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
742 collapseSuperGroups: true, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
743 trixURI: 'https://www.biodalliance.org/datasets/geneIndex.ix'}," |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
744 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
745 repeatsTrack="{name: 'Repeats', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
746 desc: 'Repeat annotation from Ensembl 59', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
747 bwgURI: 'https://www.biodalliance.org/datasets/repeats.bb', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
748 stylesheet_uri: 'https://www.biodalliance.org/stylesheets/bb-repeats.xml'}," |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
749 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
750 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
751 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
752 contentline="${contentline} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
753 <script language=\"javascript\" src=\"https://www.biodalliance.org/release-0.13/dalliance-compiled.js\"></script> |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
754 <script language=\"javascript\"> |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
755 new Browser({ |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
756 chr: '$initialchrom', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
757 viewStart: $initialstart, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
758 viewEnd: $initialend, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
759 cookieKey: 'human', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
760 pageName: 'svgHolder${gbcount}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
761 ${coordSystem} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
762 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
763 ${chains} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
764 sources: [{name: 'Genome', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
765 twoBitURI: 'https://www.biodalliance.org/datasets/${buildver}.2bit', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
766 tier_type: 'sequence'}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
767 ${genesTrack}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
768 ${repeatsTrack}, |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
769 {name: 'Conservation', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
770 desc: 'Conservation', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
771 bwgURI: 'https://www.biodalliance.org/datasets/phastCons46way.bw', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
772 noDownsample: true} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
773 ${userTracks} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
774 ], |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
775 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
776 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
777 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
778 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
779 browserLinks: { |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
780 Ensembl: 'http://www.ensembl.org/Homo_sapiens/Location/View?r=${chr}:${start}-${end}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
781 UCSC: 'http://genome.ucsc.edu/cgi-bin/hgTracks?db=${buildver}&position=chr${chr}:${start}-${end}', |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
782 Sequence: 'http://www.derkholm.net:8080/das/${buildver}comp/sequence?segment=${chr}:${start},${end}' |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
783 } |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
784 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
785 }); |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
786 </script> |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
787 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
788 <div id=\"svgHolder${gbcount}\"></div> |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
789 " |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
790 fi |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
791 |
4 | 792 ## |
793 ## Link to Dataset | |
794 ## | |
0 | 795 if [ ${myarr[1]} == "link" ] |
796 then | |
797 linkfile=${myarr[2]} | |
798 apiid=${myarr[4]} | |
799 isireport=${myarr[5]} | |
800 linkfilename=`basename ${linkfile}` | |
801 linktext=${myarr[6]} | |
802 | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
803 localhost=${myarr[7]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
804 proxy=${myarr[8]} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
805 localhost=${localhost//==colon==/:} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
806 localhost=${localhost//==fslash==/\/} |
0 | 807 |
808 #check for some basic filetypes | |
809 ftype=`file $linkfile` | |
810 if [[ $ftype == *HTML* ]] | |
811 then | |
812 linkfilename=${linkfilename%.dat} | |
813 linkfilename=${linkfilename}.html | |
814 fi | |
815 if [[ $ftype == *PNG* ]] | |
816 then | |
817 linkfilename=${linkfilename%.dat} | |
818 linkfilename=${linkfilename}.png | |
819 fi | |
820 if [[ $ftype == *SVG* ]] | |
821 then | |
822 linkfilename=${linkfilename%.dat} | |
823 linkfilename=${linkfilename}.svg | |
824 fi | |
825 if [[ $ftype == *JPEG* ]] | |
826 then | |
827 linkfilename=${linkfilename%.dat} | |
828 linkfilename=${linkfilename}.jpg | |
829 fi | |
830 | |
831 | |
832 if [[ ${isireport} == "Y" ]] | |
833 then | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
834 linkfilename="/${proxy}/datasets/${apiid}/display/" |
0 | 835 else |
836 cp ${linkfile} "${galaxypath}/${linkfilename}" | |
837 fi | |
838 | |
839 contentline="${contentline}<a href=\"${linkfilename}\">${linktext}</a>" | |
840 fi | |
841 | |
4 | 842 ## |
843 ## Links to Archive Contents | |
844 ## | |
0 | 845 if [[ ${myarr[1]} == "links" ]] |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
846 then |
0 | 847 archive=${myarr[2]} |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
848 decompressArchive $archive |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
849 |
0 | 850 # add links to webpage |
851 # separate line for each folder, files within folder on same line | |
852 for linkfile in `ls ${galaxypath}/archive_${fname}/ |sort -V` | |
853 do | |
854 #echo "<br/> ->making link to file: $linkfile " | |
855 if [ -d ${galaxypath}/archive_${fname}/$linkfile ] # if directory, add break, and list all contained files, max level 1 deep | |
856 then | |
857 #echo "<br/> ->is directory, entering: $linkfile " | |
858 #ls ${galaxypath}/archive_${fname}/$linkfile | |
859 contentline="${contentline}" | |
860 for linkfile2 in `ls ${galaxypath}/archive_${fname}/$linkfile | sort -V` | |
861 do | |
862 #echo "<br/> ->making link to file: ${galaxypath}/archive_${fname}/$linkfile2" | |
863 if [ -f ${galaxypath}/archive_${fname}/$linkfile/$linkfile2 ] # if directory, add break, and list all contained files, max level 1 deep | |
864 then | |
865 #echo "<br/> ->is file, making link: $linkfile " | |
866 label=`basename $linkfile2` | |
867 label=${label%.*} | |
868 contentline="${contentline}<a class=\"mylinks\" href=\"archive_${fname}/${linkfile}/${linkfile2}\">${label}</a> \n " | |
869 fi | |
870 done | |
871 elif [ -f ${galaxypath}/archive_${fname}/$linkfile ] | |
872 then | |
873 label=`basename ${galaxypath}/archive_${fname}/$linkfile` | |
874 label=${label%.*} | |
875 contentline="${contentline}<a class=\"mylinks\" href=\"archive_${fname}/${linkfile}\">$label</a> \n" | |
876 fi | |
877 done | |
878 | |
879 | |
880 fi | |
881 | |
882 if [[ ${myarr[3]} == "Y" ]] | |
883 then | |
4 | 884 contentline="${contentline}<br/>\n" |
0 | 885 fi |
886 fi | |
887 done | |
888 | |
889 echo "${contentline}" | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
890 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
891 |
0 | 892 } |
893 | |
4 | 894 ## |
895 ## Create HTML content for iReport | |
896 ## | |
0 | 897 createMainPage (){ |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
898 #export IFRAMECNT=1 |
0 | 899 page=$1 |
4 | 900 tabtitles=$2 # comma-separated list of tab titles |
901 tabitems=$3 # colon-sparated list of tabs specifications | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
902 #giframecount=1 # keep track of number of iFrames so that they can be referenced by ID |
4 | 903 minwidth=$4 # width of page |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
904 gbtracks=$5 # genome browser track information |
0 | 905 |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
906 echo "createMainPage: tabitems: $tabitems. tabtitles: $tabtitles. gbtracks: $gbtracks" |
0 | 907 # create correct number of tabs |
908 count=0 | |
909 | |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
910 tabtitles=${tabtitles/,/} |
0 | 911 tabtitles=${tabtitles//,/ } |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
912 echo $tabtitles |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
913 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
914 tabcount=0 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
915 for tabt in $tabtitles |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
916 do |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
917 echo -n $tabt > tmpfileb64 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
918 thistabtitle=`base64 -d tmpfileb64` |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
919 newtabtitles+=" $thistabtitle" |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
920 tabcount=$[tabcount+1] |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
921 done |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
922 |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
923 echo $newtabtitles |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
924 |
0 | 925 tabslist="<ul>\n" |
926 mytabs="" | |
4 | 927 |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
928 for title in $newtabtitles |
0 | 929 do |
4 | 930 # Create list of tabs |
0 | 931 count=$[count+1] |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
932 title2=${title//==space==/ } |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
933 title2=${title2//==dollar==/$} |
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
934 title2=${title2//==colon==/} |
0 | 935 tabslist="${tabslist} <li><a href=\"#tabs-${count}\">${title2}</a></li>\n" |
936 | |
4 | 937 # Create tabs with content |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
938 tabcontent=$(makeTabContent $title "$tabitems" "$gbtracks") |
0 | 939 mytabs="${mytabs}\n<div id=\"tabs-${count}\">\n" |
940 mytabs="${mytabs}${tabcontent}" | |
941 mytabs="${mytabs}\n</div>\n" | |
942 done | |
943 tabslist="${tabslist}</ul>" | |
944 | |
4 | 945 ## Output the webpage |
0 | 946 echo -e "<!doctype html> |
4 | 947 <head> |
0 | 948 <meta charset=\"utf-8\"> |
4 | 949 <title>iReport</title> |
950 <link rel=\"stylesheet\" href=\"jquery-ui.css\"> | |
951 <link rel=\"stylesheet\" href=\"ireport_css.css\"> | |
952 <link rel=\"stylesheet\" href=\"md.css\"> | |
953 <script type=\"text/javascript\" src=\"jquery-1.10.2.js\"></script> | |
954 <script type=\"text/javascript\" src=\"jquery-ui.js\"></script> | |
0 | 955 <script type=\"text/javascript\" src=\"iframe-resizer/src/iframeResizer.js\"></script> |
956 <script type=\"text/javascript\" src=\"jquery.zoom.js\"></script> | |
4 | 957 <script type=\"text/javascript\" src=\"ireport_jquery.js\"></script> |
958 <script type=\"text/javascript\" src=\"ireport_javascript.js\"></script> | |
959 </head> | |
960 <body> | |
961 <div id=\"tabs\" style=\"display:inline-block; min-height:100%; min-width:${minwidth}px\"> | |
962 $tabslist | |
0 | 963 |
4 | 964 $mytabs |
965 </div> | |
966 </body> | |
0 | 967 </html>" > $page |
6
42076db43d42
Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
4
diff
changeset
|
968 } |