Mercurial > repos > saskia-hiltemann > ireport_devel
diff createHTML.sh @ 1:d582e2cd3e13 draft
Uploaded
author | saskia-hiltemann |
---|---|
date | Wed, 15 Jul 2015 08:52:21 -0400 |
parents | 3c160414da2e |
children | 945e72d0e723 |
line wrap: on
line diff
--- a/createHTML.sh Thu Feb 26 14:05:23 2015 +0100 +++ b/createHTML.sh Wed Jul 15 08:52:21 2015 -0400 @@ -22,7 +22,7 @@ <b><font size=\"15\"> iReport: ${title} </font></b><br/> <br/> <br/> - <a href=\"$link\"> Click here to view report </a> <br/><br/> + <a href=\"$link\"> Click image to view report </a> <br/><br/> <a href=\"$link\"> <img src="$coverimage" width=\"50%\" alt=\"loading image..\"/> </a><br/><br/> <a href=\"$zipireport\"> Click here to download a copy of this iReport </a> <br/><br/> </center> @@ -137,6 +137,12 @@ text=${text//==space==/ } text=${text//==colon==/:} text=${text//==comma==/,} + + text=${text//==braceopen==/(} + text=${text//==braceclose==/)} + text=${text//==cbraceopen==/{} + text=${text//==cbraceclose==/}} + text=${text//==slash==/\/} text=${text//==lt==/<} text=${text//==gt==/>} @@ -152,8 +158,8 @@ text=${text//\&r/\\n} text=${text//\&n/\\n} text=${text//\&c/:} - - + + ## convert markdown in textfield to html echo -e "$text" > mytext.md @@ -221,6 +227,10 @@ text=${text//==backtick==/`} text=${text//==dollar==/$} text=${text//==bar==/|} + text=${text//==braceopen==/(} + text=${text//==braceclose==/)} + text=${text//==cbraceopen==/{} + text=${text//==cbraceclose==/}} contentline="${contentline}\n${text}\n" fi @@ -281,6 +291,7 @@ zoomlevel=${myarr[4]} zoomenable=${myarr[5]} align=${myarr[6]} + typestring="" #####echo "zoomenable:${zoomenable}, align:${align}" if [[ $ftype == *JPEG* ]] then @@ -294,6 +305,11 @@ then suffix=".png" fi + if [[ $ftype == *TIFF* ]] + then + suffix=".tiff" + typestring="type=\"image/tiff\"" + fi image=`basename ${myarr[2]}` image=${image%.dat} @@ -369,6 +385,7 @@ suffix=${myarr[8]} urlitems=${myarr[9]} minw=${myarr[10]} + minh=${myarr[11]} suffix=${suffix/emptycol/} suffix=${suffix/==quote==/&} prefix=${prefix/emptycol/} @@ -407,6 +424,7 @@ else minw=${myarr[6]} + minh=${myarr[7]} cp ${tsvfile} ${tsvfile}2 fi @@ -414,11 +432,11 @@ if [ $fancy == "Y" ] then perl ${repositorypath}/tsv2html.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html - contentline="${contentline}\n<iframe class=\"invisibleframe fancyiframe\" id=\"$iframeid\" src=\"htmltable_${fname}.html\" width=\"100%\" style=\"height: 760px; min-height: 525px; overflow-y: hidden; overflow-x: scroll\" ></iframe>" + 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\" ></iframe>" iframecount=$[$iframecount+1] else perl ${repositorypath}/tsv2html_simple.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html - contentline="${contentline}\n<iframe class=\"unfancyiframe invisibleframe\" id=\"$iframeid\" src=\"htmltable_${fname}.html\" scrolling=\"no\" style=\"min-width: ${minw}px; max-width: 100%; vertical-align: top;\" onload=\"resizeIframe(this)\"></iframe>" + 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>" iframecount=$[$iframecount+1] fi @@ -462,7 +480,19 @@ htmlname="${fname}.html" cp ${htmlfile} "${galaxypath}/${htmlname}" - contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${htmlname}\" width=\"100%\" height=\"${height}px\"></iframe>\n" + apiid=${myarr[5]} + isireport=${myarr[6]} + localhost=${myarr[7]} + proxy=${myarr[8]} + localhost=${localhost//==colon==/:} + localhost=${localhost//==fslash==/\/} + if [[ ${isireport} == "Y" ]] + then + #cp ${localhost}/datasets/${apiid}/* "${galaxypath}/tst" + htmlname="/${proxy}/datasets/${apiid}/display/" + fi + + contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${htmlname}\" width=\"100%\" height=\"${height}px\"></iframe>\n" fi @@ -471,8 +501,7 @@ url=${myarr[2]} url=${url//==colon==/:} url=${url//==fslash==//} - height=${myarr[4]} - + height=${myarr[4]} contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${url}\" width=\"100%\" height=\"${height}px\"></iframe>\n" fi @@ -483,9 +512,17 @@ then url=${myarr[2]} linktext=${myarr[4]} - url=${url/==colon==/:} - url=${url/==quote==/&} + + echo -n "$url" > tmpfileb64 + url=`base64 -d tmpfileb64` + echo -n "$linktext" > tmpfileb64 + linktext=`base64 -d tmpfileb64` + + if [[ -z $linktext ]] + then + linktext=$url + fi contentline="${contentline}<a href=\"${url}\" target=\"_blank\">${linktext}</a>" fi @@ -495,12 +532,28 @@ ## if [ ${myarr[1]} == "genomebrowser" ] then + # parse inputs apiid=${myarr[4]} servername=${myarr[5]} buildver=${myarr[2]} + + region=${myarr[6]} + + + echo -n "$region" > tmpfileb64 + region=`base64 -d tmpfileb64` + + + initialchrom=${region%:*} + initialrange=${region#*:} + + initialstart=${initialrange%-*} + initialend=${initialrange#*-} + + #TODO ftype="vcf" @@ -521,19 +574,23 @@ then ftype=${gbfileinfo[3]} - if [ $ftype == "vcf" ] + + gbfilename=${gbfileinfo[1]} + gbfilelabel=${gbfileinfo[2]} + gbfilelabel=${gbfilelabel//==space==/ } + gbfilelabel=${gbfilelabel//==bopen==/(} + gbfilelabel=${gbfilelabel//==bclose==/)} + fname=`basename ${gbfilename}` + fname=${fname%.dat} + + if [[ $ftype == "vcftabix" ]] then - gbfilename=${gbfileinfo[1]} - gbfilelabel=${gbfileinfo[2]} - gbfilelabel=${gbfilelabel//==space==/ } - fname=`basename ${gbfilename}` - fname=${fname%.dat} newgbfilename="${fname}.vcf" cp ${gbfilename} "${galaxypath}/${newgbfilename}" bgzip "${galaxypath}/${newgbfilename}" - tabix -p vcf "${galaxypath}/${newgbfilename}.gz" + tabix -f -p vcf "${galaxypath}/${newgbfilename}.gz" userTracks="${userTracks}, {name: '${gbfilelabel}', @@ -543,13 +600,25 @@ " fi - if [ $ftype == "bam" ] + if [[ $ftype == "vcfmemstore" ]] then - gbfilename=${gbfileinfo[1]} - gbfilelabel=${gbfileinfo[2]} - gbfilelabel=${gbfilelabel//==space==/ } - fname=`basename ${gbfilename}` - fname=${fname%.dat} + newgbfilename="${fname}.vcf" + + + cp ${gbfilename} "${galaxypath}/${newgbfilename}" + #bgzip "${galaxypath}/${newgbfilename}" + #tabix -p vcf "${galaxypath}/${newgbfilename}.gz" + + userTracks="${userTracks}, + {name: '${gbfilelabel}', + uri: '${servername}/datasets/${apiid}/display/${newgbfilename}', + tier_type: 'memstore', + payload: 'vcf'} + " + fi + + if [[ $ftype == "bam" ]] + then newgbfilename="${fname}.bam" # link to bam instead of copying @@ -562,6 +631,55 @@ " fi + + if [[ $ftype == "bigbed" ]] + then + newgbfilename="${fname}.bigbed" + + cp ${gbfilename} "${galaxypath}/${newgbfilename}" + #bgzip "${galaxypath}/${newgbfilename}" + #tabix -f -p bed "${galaxypath}/${newgbfilename}.gz" + + userTracks="${userTracks}, + {name: '${gbfilelabel}', + bwgURI: '${servername}/datasets/${apiid}/display/${newgbfilename}'} + " + + fi + + if [[ $ftype == "bedtabix" ]] + then + newgbfilename="${fname}.bed" + + cp ${gbfilename} "${galaxypath}/${newgbfilename}" + bgzip "${galaxypath}/${newgbfilename}" + tabix -f -p bed "${galaxypath}/${newgbfilename}.gz" + + userTracks="${userTracks}, + {name: '${gbfilelabel}', + uri: '${servername}/datasets/${apiid}/display/${newgbfilename}.gz', + tier_type: 'tabix', + payload: 'bed'} + " + + fi + + if [[ $ftype == "bedmemstore" ]] + then + newgbfilename="${fname}.bed" + + cp ${gbfilename} "${galaxypath}/${newgbfilename}" + #bgzip "${galaxypath}/${newgbfilename}" + #tabix -p bed "${galaxypath}/${newgbfilename}.gz" + + userTracks="${userTracks}, + {name: '${gbfilelabel}', + uri: '${servername}/datasets/${apiid}/display/${newgbfilename}', + tier_type: 'memstore', + payload: 'bed'} + " + + fi fi done @@ -632,11 +750,11 @@ <script language=\"javascript\" src=\"https://www.biodalliance.org/release-0.13/dalliance-compiled.js\"></script> <script language=\"javascript\"> new Browser({ - chr: '1', - viewStart: 0, - viewEnd: 100000, + chr: '$initialchrom', + viewStart: $initialstart, + viewEnd: $initialend, cookieKey: 'human', - + pageName: 'svgHolder${gbcount}', ${coordSystem} ${chains} @@ -664,7 +782,7 @@ }); </script> -<div id=\"svgHolder\"></div> +<div id=\"svgHolder${gbcount}\"></div> " fi @@ -679,6 +797,10 @@ linkfilename=`basename ${linkfile}` linktext=${myarr[6]} + localhost=${myarr[7]} + proxy=${myarr[8]} + localhost=${localhost//==colon==/:} + localhost=${localhost//==fslash==/\/} #check for some basic filetypes ftype=`file $linkfile` @@ -706,7 +828,7 @@ if [[ ${isireport} == "Y" ]] then - linkfilename="/datasets/${apiid}/display/" + linkfilename="/${proxy}/datasets/${apiid}/display/" else cp ${linkfile} "${galaxypath}/${linkfilename}" fi @@ -779,16 +901,31 @@ # create correct number of tabs count=0 + tabtitles=${tabtitles/,/} tabtitles=${tabtitles//,/ } - tabtitles=${tabtitles//==colon==/:} + echo $tabtitles + + tabcount=0 + for tabt in $tabtitles + do + echo -n $tabt > tmpfileb64 + thistabtitle=`base64 -d tmpfileb64` + newtabtitles+=" $thistabtitle" + tabcount=$[tabcount+1] + done + + echo $newtabtitles + tabslist="<ul>\n" mytabs="" - for title in $tabtitles + for title in $newtabtitles do # Create list of tabs count=$[count+1] - title2=${title//_s_/ } + title2=${title//==space==/ } + title2=${title2//==dollar==/$} + title2=${title2//==colon==/} tabslist="${tabslist} <li><a href=\"#tabs-${count}\">${title2}</a></li>\n" # Create tabs with content