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