diff iReport.sh @ 6:42076db43d42 draft

Fixed auto resizing plus various other minor bugs
author saskia-hiltemann
date Mon, 16 Nov 2015 08:56:22 -0500
parents a4813532bbc6
children
line wrap: on
line diff
--- a/iReport.sh	Tue Oct 07 08:49:14 2014 -0400
+++ b/iReport.sh	Mon Nov 16 08:56:22 2015 -0500
@@ -1,5 +1,4 @@
 #!/bin/bash
-#repositorypath="/mnt/galaxyTools/shed_tools/toolshed.nbic.nl/repos/saskia-hiltemann/ireport/71dc132e9bb2/ireport"  # TODO: dependency
 
 
 echo "allparams: $@"
@@ -8,8 +7,8 @@
 
 # set some defaults
 
-
-set -- `getopt -n$0 -u -a --longoptions="ifusepath: galaxypath: tab: item: htmlout: label: toolpath: minwidth: coverimage:" "h:" "$@"` || usage
+gbcount=0
+set -- `getopt -n$0 -u -a --longoptions="ifusepath: galaxypath: tab: item: genomebrowsertrack: newgb: htmlout: label: toolpath: minwidth: coverimage:" "h:" "$@"` || usage
 [ $# -eq 0 ] && usage
 
 while [ $# -gt 0 ]
@@ -20,6 +19,8 @@
 		--minwidth)				minwidth=$2;shift;; 
 		--tab)					tabs+=",$2";shift;;
 		--item)					items+=",$2";shift;;
+		--newgb)				gbcount=$[$gbcount+1];shift;;
+		--genomebrowsertrack)	gbtracks+=",${gbcount}:$2";shift;;
 		--htmlout)				htmlout=$2;shift;;
 		--label)				title="$@";shift;;
 		--coverimage)			coverimage=$2;shift;;
@@ -34,10 +35,23 @@
 source "${repositorypath}/createHTML.sh"
 mkdir $galaxypath
 
-tabs=${tabs//,/ }; tabs=${tabs/ /}
+#tabs=${tabs//,/ }; tabs=${tabs/ /}
+#tabs=${tabs//==dollar==/$}
+#tabs=${tabs//==braceopen==/(}
+#tabs=${tabs//==braceclose==/)}
+gbtracks=${gbtracks:1}
 items=${items//,/ }; items=${items/ /}
+
 title=${title//--/}
 title=${title//label/}
+title=${title// /}
+
+echo -e "title:      $title"
+echo -n "$title" > tmpfileb64
+title=`base64 -d tmpfileb64`
+echo -e "title decoded:      $title"
+
+#title=${title%--*}
 
 reportname=${title// /}
 
@@ -47,6 +61,8 @@
 echo -e "items:      $items"
 echo -e "htmlout:    $htmlout"
 echo -e "coverimage: $coverimage"
+echo -e "gbtracks:   ${gbtracks[@]}"
+echo -e "gbcount:   ${gbcount}"
 echo -e "\n"
 
 for i in $tabs
@@ -54,22 +70,24 @@
 	echo "tabname: $i" 
 done
 
-coverimage=${coverimage:1}
-echo -e "coverimage2: $coverimage"
+
 
 #if no coverimage provided, use default EMC logo
-if [[ -z $coverimage ]] 
+if [[ $coverimage == "-" ]] 
 then
 	cp $repositorypath/intro.jpg ${galaxypath}/intro.jpg
-	coverimage="intro.jpg"
+	coverimage="intro.jpg" 
+else
+	coverimage=${coverimage:1}
+	echo -n "$coverimage" > tmpfileb64
+	coverimage=`base64 -d tmpfileb64`
 fi
-echo -e "coverimage3: $coverimage"
 
 ## Copy supporting files from repository to output directory
 cp ${repositorypath}/jquery.dataTables.css ${galaxypath}/jquery.dataTables.css
 cp ${repositorypath}/jquery.dataTables.js ${galaxypath}/jquery.dataTables.js
-cp -R ${repositorypath}/iframe-resizer/ ${galaxypath}/iframe-resizer/
-cp -R ${repositorypath}/DataTables-1.9.4/ ${galaxypath}/DataTables-1.9.4/
+cp -R ${repositorypath}/iframe-resizer/ ${galaxypath}/iframe-resizer/ > /dev/null 2>&1
+cp -R ${repositorypath}/DataTables-1.9.4/ ${galaxypath}/DataTables-1.9.4/ > /dev/null 2>&1
 cp ${repositorypath}/jquery.zoom.js ${galaxypath}/jquery.zoom.js
 cp ${repositorypath}/jquery-ui.css ${galaxypath}/jquery-ui.css
 cp ${repositorypath}/jquery-1.10.2.js ${galaxypath}/jquery-1.10.2.js
@@ -90,12 +108,13 @@
 cp coverpage.html ${galaxypath}/coverpage.html
 
 ## Create Report page with tabs
-createMainPage ${galaxypath}/report.html "$tabs" "$items" $minwidth
+createMainPage ${galaxypath}/report.html "$tabs" "$items" $minwidth "$gbtracks"
 
 
 ## Create zip file of this iReport for download by user
 wd=`pwd`
 cd ${galaxypath}
-zip -r iReport_${reportname} .
+zip -r iReport_${reportname} . > /dev/null 2>&1
 cd $wd
 
+wait
\ No newline at end of file