Mercurial > repos > saskia-hiltemann > ireport_devel
comparison createHTML.sh @ 4:363cd315d0e9 draft
Uploaded
author | saskia-hiltemann |
---|---|
date | Mon, 16 Nov 2015 09:46:51 -0500 |
parents | 945e72d0e723 |
children |
comparison
equal
deleted
inserted
replaced
3:945e72d0e723 | 4:363cd315d0e9 |
---|---|
1 gbcount=0 | 1 gbcount=0 |
2 | 2 |
3 ## | 3 ## |
4 ## Create Cover Page | 4 ## Create Cover Page |
5 ## | 5 ## |
6 #<a href=\"$zipireport\"> Click here to download a copy of this iReport </a> <br/><br/> | |
6 function makeIntroPage ( ){ | 7 function makeIntroPage ( ){ |
7 echo "Creating Intro Page" | 8 echo "Creating Intro Page" |
8 title="$1" | 9 title="$1" |
9 coverimage=$2 | 10 coverimage=$2 |
10 link=$3 | 11 link=$3 |
22 <b><font size=\"15\"> iReport: ${title} </font></b><br/> | 23 <b><font size=\"15\"> iReport: ${title} </font></b><br/> |
23 <br/> | 24 <br/> |
24 <br/> | 25 <br/> |
25 <a href=\"$link\"> Click image to view report </a> <br/><br/> | 26 <a href=\"$link\"> Click image to view report </a> <br/><br/> |
26 <a href=\"$link\"> <img src="$coverimage" width=\"50%\" alt=\"loading image..\"/> </a><br/><br/> | 27 <a href=\"$link\"> <img src="$coverimage" width=\"50%\" alt=\"loading image..\"/> </a><br/><br/> |
27 <a href=\"$zipireport\"> Click here to download a copy of this iReport </a> <br/><br/> | |
28 </center> | 28 </center> |
29 </body> | 29 </body> |
30 </html>" > $htmlout | 30 </html>" > $htmlout |
31 | 31 |
32 } | 32 } |
108 tab=$1 # name of current tab | 108 tab=$1 # name of current tab |
109 itemslist=$2 # list of all items | 109 itemslist=$2 # list of all items |
110 tracklist=$3 # genome browser tracks info | 110 tracklist=$3 # genome browser tracks info |
111 contentline="" # HTML code for tab | 111 contentline="" # HTML code for tab |
112 imgcount=0 # keep track of the number of images on the current tab | 112 imgcount=0 # keep track of the number of images on the current tab |
113 iframecount=0 | 113 iframename=`head -n 1 < /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1` |
114 | 114 #iframename="test" |
115 for item in $itemslist | 115 for item in $itemslist |
116 do | 116 do |
117 ## Parse items lists | 117 ## Parse items lists |
118 item=${item/::/:emptycol:} | 118 item=${item/::/:emptycol:} |
119 declare -a myarr=(`echo $item |sed 's/:/ /g'`) | 119 declare -a myarr=(`echo $item |sed 's/:/ /g'`) |
335 else | 335 else |
336 widthstring="width=\"${zoomlevel}\"" | 336 widthstring="width=\"${zoomlevel}\"" |
337 fi | 337 fi |
338 | 338 |
339 if [[ ${zoomlevel} -eq 0 || ${zoomenable} == "N" ]] | 339 if [[ ${zoomlevel} -eq 0 || ${zoomenable} == "N" ]] |
340 then | 340 then |
341 contentline="${contentline}<span id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>" | 341 contentline="${contentline}<span id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>" |
342 else | 342 else |
343 contentline="${contentline}<span class=\"zoomme\" id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>" | 343 contentline="${contentline}<span class=\"zoomme\" id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>" |
344 fi | 344 fi |
345 | 345 |
346 fi | 346 fi |
356 tsvfile="tablehead.tsv" | 356 tsvfile="tablehead.tsv" |
357 fname=`basename ${tsvfile_orig}` | 357 fname=`basename ${tsvfile_orig}` |
358 fname=${fname%.*} | 358 fname=${fname%.*} |
359 fancy=${myarr[4]} | 359 fancy=${myarr[4]} |
360 makelinks=${myarr[5]} | 360 makelinks=${myarr[5]} |
361 iframeid="iframe"$iframecount | 361 #iframeid="iframe$giframecount" |
362 iframeid="iframe-$iframename" | |
363 | |
362 #echo "\nmakelinks: $makelinks fancy: $fancy <br>" | 364 #echo "\nmakelinks: $makelinks fancy: $fancy <br>" |
363 | 365 |
364 #TODO client side database for large files. For now only display first section of file and add download link | 366 #TODO client side database for large files. For now only display first section of file and add download link |
365 numlines=`wc -l ${tsvfile_orig} |cut -d" " -f1` | 367 numlines=`wc -l ${tsvfile_orig} |cut -d" " -f1` |
366 | 368 |
426 minw=${myarr[6]} | 428 minw=${myarr[6]} |
427 minh=${myarr[7]} | 429 minh=${myarr[7]} |
428 cp ${tsvfile} ${tsvfile}2 | 430 cp ${tsvfile} ${tsvfile}2 |
429 fi | 431 fi |
430 | 432 |
431 iframecount=$[$iframecount+1] | 433 #iframecount=$[$iframecount+1] |
434 | |
432 if [ $fancy == "Y" ] | 435 if [ $fancy == "Y" ] |
433 then | 436 then |
434 perl ${repositorypath}/tsv2html.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html | 437 perl ${repositorypath}/tsv2html.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html |
435 contentline="${contentline}\n<iframe class=\"invisibleframe fancyiframe\" id=\"$iframeid\" src=\"htmltable_${fname}.html\" width=\"100%\" style=\"height: 760px; min-height: ${minh}px !important; overflow-y: hidden; overflow-x: scroll\" ></iframe>" | 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>" |
436 iframecount=$[$iframecount+1] | 439 |
437 else | 440 else |
438 perl ${repositorypath}/tsv2html_simple.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html | 441 perl ${repositorypath}/tsv2html_simple.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html |
439 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;\" onload=\"resizeIframe(this)\"></iframe>" | 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>" |
440 iframecount=$[$iframecount+1] | 443 |
441 fi | 444 fi |
442 | 445 |
443 if [[ $numlines -gt ${maxlines} ]] | 446 if [[ $numlines -gt ${maxlines} ]] |
444 then | 447 then |
445 tablename=`basename ${tsvfile_orig}` | 448 tablename=`basename ${tsvfile_orig}` |
626 samtools index "${galaxypath}/${newgbfilename}" | 629 samtools index "${galaxypath}/${newgbfilename}" |
627 | 630 |
628 userTracks="${userTracks}, | 631 userTracks="${userTracks}, |
629 {name: '${gbfilelabel}', | 632 {name: '${gbfilelabel}', |
630 bamURI: '${servername}/datasets/${apiid}/display/${newgbfilename}'} | 633 bamURI: '${servername}/datasets/${apiid}/display/${newgbfilename}'} |
634 " | |
635 | |
636 fi | |
637 | |
638 if [[ $ftype == "bigbed" ]] | |
639 then | |
640 newgbfilename="${fname}.bigbed" | |
641 | |
642 cp ${gbfilename} "${galaxypath}/${newgbfilename}" | |
643 #bgzip "${galaxypath}/${newgbfilename}" | |
644 #tabix -f -p bed "${galaxypath}/${newgbfilename}.gz" | |
645 | |
646 userTracks="${userTracks}, | |
647 {name: '${gbfilelabel}', | |
648 bwgURI: '${servername}/datasets/${apiid}/display/${newgbfilename}'} | |
631 " | 649 " |
632 | 650 |
633 fi | 651 fi |
634 | 652 |
635 if [[ $ftype == "bedtabix" ]] | 653 if [[ $ftype == "bedtabix" ]] |
867 fi | 885 fi |
868 fi | 886 fi |
869 done | 887 done |
870 | 888 |
871 echo "${contentline}" | 889 echo "${contentline}" |
890 | |
891 | |
872 } | 892 } |
873 | 893 |
874 ## | 894 ## |
875 ## Create HTML content for iReport | 895 ## Create HTML content for iReport |
876 ## | 896 ## |
877 createMainPage (){ | 897 createMainPage (){ |
898 #export IFRAMECNT=1 | |
878 page=$1 | 899 page=$1 |
879 tabtitles=$2 # comma-separated list of tab titles | 900 tabtitles=$2 # comma-separated list of tab titles |
880 tabitems=$3 # colon-sparated list of tabs specifications | 901 tabitems=$3 # colon-sparated list of tabs specifications |
881 iframecount=1 # keep track of number of iFrames so that they can be referenced by ID | 902 #giframecount=1 # keep track of number of iFrames so that they can be referenced by ID |
882 minwidth=$4 # width of page | 903 minwidth=$4 # width of page |
883 gbtracks=$5 # genome browser track information | 904 gbtracks=$5 # genome browser track information |
884 | 905 |
885 echo "createMainPage: tabitems: $tabitems. tabtitles: $tabtitles. gbtracks: $gbtracks" | 906 echo "createMainPage: tabitems: $tabitems. tabtitles: $tabtitles. gbtracks: $gbtracks" |
886 # create correct number of tabs | 907 # create correct number of tabs |