diff iReport.sh @ 2:3c160414da2e default tip

initial upload
author shiltemann
date Thu, 26 Feb 2015 14:05:23 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iReport.sh	Thu Feb 26 14:05:23 2015 +0100
@@ -0,0 +1,109 @@
+#!/bin/bash
+
+
+echo "allparams: $@"
+function usage() { echo "Oops!"; }
+
+
+# set some defaults
+
+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 ]
+do
+    case "$1" in
+       	--toolpath)				repositorypath=$2;shift;;
+		--galaxypath)			galaxypath=$2;shift;;
+		--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;;
+        -h)        	shift;;
+		--)        	shift;break;;
+        -*)        	usage;;
+        *)         	break;;
+    esac
+    shift
+done
+
+source "${repositorypath}/createHTML.sh"
+mkdir $galaxypath
+
+tabs=${tabs//,/ }; tabs=${tabs/ /}
+gbtracks=${gbtracks:1}
+items=${items//,/ }; items=${items/ /}
+echo -e "title:      $title"
+
+#title=${title%--*}
+title=${title//--/}
+title=${title//label/}
+
+reportname=${title// /}
+
+echo -e "\n"
+echo -e "title:      $title"
+echo -e "tabs:       $tabs"
+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
+do 
+	echo "tabname: $i" 
+done
+
+coverimage=${coverimage:1}
+echo -e "coverimage2: $coverimage"
+
+#if no coverimage provided, use default EMC logo
+if [[ -z $coverimage ]] 
+then
+	cp $repositorypath/intro.jpg ${galaxypath}/intro.jpg
+	coverimage="intro.jpg" 
+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 ${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
+cp ${repositorypath}/jquery-ui.js ${galaxypath}/jquery-ui.js
+cp ${repositorypath}/md.css ${galaxypath}/md.css
+cp ${repositorypath}/ireport_css.css ${galaxypath}/ireport_css.css
+cp ${repositorypath}/ireport_jquery.js ${galaxypath}/ireport_jquery.js
+
+echo "done copying resource files"
+ls ${galaxypath}
+
+
+## Create cover HTML page
+makeIntroPage "$title" $coverimage "report.html" $htmlout iReport_${reportname}.zip
+
+## Create copy of cover page for downloadable version
+makeIntroPage "$title" $coverimage "report.html" coverpage.html iReport_${reportname}.zip
+cp coverpage.html ${galaxypath}/coverpage.html
+
+## Create Report page with tabs
+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} .
+cd $wd
+
+wait
\ No newline at end of file