Mercurial > repos > saskia-hiltemann > ireport
comparison 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 |
comparison
equal
deleted
inserted
replaced
5:4e21ce709269 | 6:42076db43d42 |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 #repositorypath="/mnt/galaxyTools/shed_tools/toolshed.nbic.nl/repos/saskia-hiltemann/ireport/71dc132e9bb2/ireport" # TODO: dependency | |
3 | 2 |
4 | 3 |
5 echo "allparams: $@" | 4 echo "allparams: $@" |
6 function usage() { echo "Oops!"; } | 5 function usage() { echo "Oops!"; } |
7 | 6 |
8 | 7 |
9 # set some defaults | 8 # set some defaults |
10 | 9 |
11 | 10 gbcount=0 |
12 set -- `getopt -n$0 -u -a --longoptions="ifusepath: galaxypath: tab: item: htmlout: label: toolpath: minwidth: coverimage:" "h:" "$@"` || usage | 11 set -- `getopt -n$0 -u -a --longoptions="ifusepath: galaxypath: tab: item: genomebrowsertrack: newgb: htmlout: label: toolpath: minwidth: coverimage:" "h:" "$@"` || usage |
13 [ $# -eq 0 ] && usage | 12 [ $# -eq 0 ] && usage |
14 | 13 |
15 while [ $# -gt 0 ] | 14 while [ $# -gt 0 ] |
16 do | 15 do |
17 case "$1" in | 16 case "$1" in |
18 --toolpath) repositorypath=$2;shift;; | 17 --toolpath) repositorypath=$2;shift;; |
19 --galaxypath) galaxypath=$2;shift;; | 18 --galaxypath) galaxypath=$2;shift;; |
20 --minwidth) minwidth=$2;shift;; | 19 --minwidth) minwidth=$2;shift;; |
21 --tab) tabs+=",$2";shift;; | 20 --tab) tabs+=",$2";shift;; |
22 --item) items+=",$2";shift;; | 21 --item) items+=",$2";shift;; |
22 --newgb) gbcount=$[$gbcount+1];shift;; | |
23 --genomebrowsertrack) gbtracks+=",${gbcount}:$2";shift;; | |
23 --htmlout) htmlout=$2;shift;; | 24 --htmlout) htmlout=$2;shift;; |
24 --label) title="$@";shift;; | 25 --label) title="$@";shift;; |
25 --coverimage) coverimage=$2;shift;; | 26 --coverimage) coverimage=$2;shift;; |
26 -h) shift;; | 27 -h) shift;; |
27 --) shift;break;; | 28 --) shift;break;; |
32 done | 33 done |
33 | 34 |
34 source "${repositorypath}/createHTML.sh" | 35 source "${repositorypath}/createHTML.sh" |
35 mkdir $galaxypath | 36 mkdir $galaxypath |
36 | 37 |
37 tabs=${tabs//,/ }; tabs=${tabs/ /} | 38 #tabs=${tabs//,/ }; tabs=${tabs/ /} |
39 #tabs=${tabs//==dollar==/$} | |
40 #tabs=${tabs//==braceopen==/(} | |
41 #tabs=${tabs//==braceclose==/)} | |
42 gbtracks=${gbtracks:1} | |
38 items=${items//,/ }; items=${items/ /} | 43 items=${items//,/ }; items=${items/ /} |
44 | |
39 title=${title//--/} | 45 title=${title//--/} |
40 title=${title//label/} | 46 title=${title//label/} |
47 title=${title// /} | |
48 | |
49 echo -e "title: $title" | |
50 echo -n "$title" > tmpfileb64 | |
51 title=`base64 -d tmpfileb64` | |
52 echo -e "title decoded: $title" | |
53 | |
54 #title=${title%--*} | |
41 | 55 |
42 reportname=${title// /} | 56 reportname=${title// /} |
43 | 57 |
44 echo -e "\n" | 58 echo -e "\n" |
45 echo -e "title: $title" | 59 echo -e "title: $title" |
46 echo -e "tabs: $tabs" | 60 echo -e "tabs: $tabs" |
47 echo -e "items: $items" | 61 echo -e "items: $items" |
48 echo -e "htmlout: $htmlout" | 62 echo -e "htmlout: $htmlout" |
49 echo -e "coverimage: $coverimage" | 63 echo -e "coverimage: $coverimage" |
64 echo -e "gbtracks: ${gbtracks[@]}" | |
65 echo -e "gbcount: ${gbcount}" | |
50 echo -e "\n" | 66 echo -e "\n" |
51 | 67 |
52 for i in $tabs | 68 for i in $tabs |
53 do | 69 do |
54 echo "tabname: $i" | 70 echo "tabname: $i" |
55 done | 71 done |
56 | 72 |
57 coverimage=${coverimage:1} | 73 |
58 echo -e "coverimage2: $coverimage" | |
59 | 74 |
60 #if no coverimage provided, use default EMC logo | 75 #if no coverimage provided, use default EMC logo |
61 if [[ -z $coverimage ]] | 76 if [[ $coverimage == "-" ]] |
62 then | 77 then |
63 cp $repositorypath/intro.jpg ${galaxypath}/intro.jpg | 78 cp $repositorypath/intro.jpg ${galaxypath}/intro.jpg |
64 coverimage="intro.jpg" | 79 coverimage="intro.jpg" |
80 else | |
81 coverimage=${coverimage:1} | |
82 echo -n "$coverimage" > tmpfileb64 | |
83 coverimage=`base64 -d tmpfileb64` | |
65 fi | 84 fi |
66 echo -e "coverimage3: $coverimage" | |
67 | 85 |
68 ## Copy supporting files from repository to output directory | 86 ## Copy supporting files from repository to output directory |
69 cp ${repositorypath}/jquery.dataTables.css ${galaxypath}/jquery.dataTables.css | 87 cp ${repositorypath}/jquery.dataTables.css ${galaxypath}/jquery.dataTables.css |
70 cp ${repositorypath}/jquery.dataTables.js ${galaxypath}/jquery.dataTables.js | 88 cp ${repositorypath}/jquery.dataTables.js ${galaxypath}/jquery.dataTables.js |
71 cp -R ${repositorypath}/iframe-resizer/ ${galaxypath}/iframe-resizer/ | 89 cp -R ${repositorypath}/iframe-resizer/ ${galaxypath}/iframe-resizer/ > /dev/null 2>&1 |
72 cp -R ${repositorypath}/DataTables-1.9.4/ ${galaxypath}/DataTables-1.9.4/ | 90 cp -R ${repositorypath}/DataTables-1.9.4/ ${galaxypath}/DataTables-1.9.4/ > /dev/null 2>&1 |
73 cp ${repositorypath}/jquery.zoom.js ${galaxypath}/jquery.zoom.js | 91 cp ${repositorypath}/jquery.zoom.js ${galaxypath}/jquery.zoom.js |
74 cp ${repositorypath}/jquery-ui.css ${galaxypath}/jquery-ui.css | 92 cp ${repositorypath}/jquery-ui.css ${galaxypath}/jquery-ui.css |
75 cp ${repositorypath}/jquery-1.10.2.js ${galaxypath}/jquery-1.10.2.js | 93 cp ${repositorypath}/jquery-1.10.2.js ${galaxypath}/jquery-1.10.2.js |
76 cp ${repositorypath}/jquery-ui.js ${galaxypath}/jquery-ui.js | 94 cp ${repositorypath}/jquery-ui.js ${galaxypath}/jquery-ui.js |
77 cp ${repositorypath}/md.css ${galaxypath}/md.css | 95 cp ${repositorypath}/md.css ${galaxypath}/md.css |
88 ## Create copy of cover page for downloadable version | 106 ## Create copy of cover page for downloadable version |
89 makeIntroPage "$title" $coverimage "report.html" coverpage.html iReport_${reportname}.zip | 107 makeIntroPage "$title" $coverimage "report.html" coverpage.html iReport_${reportname}.zip |
90 cp coverpage.html ${galaxypath}/coverpage.html | 108 cp coverpage.html ${galaxypath}/coverpage.html |
91 | 109 |
92 ## Create Report page with tabs | 110 ## Create Report page with tabs |
93 createMainPage ${galaxypath}/report.html "$tabs" "$items" $minwidth | 111 createMainPage ${galaxypath}/report.html "$tabs" "$items" $minwidth "$gbtracks" |
94 | 112 |
95 | 113 |
96 ## Create zip file of this iReport for download by user | 114 ## Create zip file of this iReport for download by user |
97 wd=`pwd` | 115 wd=`pwd` |
98 cd ${galaxypath} | 116 cd ${galaxypath} |
99 zip -r iReport_${reportname} . | 117 zip -r iReport_${reportname} . > /dev/null 2>&1 |
100 cd $wd | 118 cd $wd |
101 | 119 |
120 wait |