annotate iReport.sh @ 8:86219e4aa239 draft

Uploaded
author saskia-hiltemann
date Mon, 28 Aug 2017 10:23:21 -0400
parents 42076db43d42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 #!/bin/bash
3
4a6ebda2a3ae fixed tool dependency issue
saskia-hiltemann
parents: 2
diff changeset
2
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 echo "allparams: $@"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 function usage() { echo "Oops!"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 # set some defaults
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 [ $# -eq 0 ] && usage
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 while [ $# -gt 0 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 case "$1" in
2
e8755431a0cd fixed missing dependencies
saskia-hiltemann
parents: 1
diff changeset
17 --toolpath) repositorypath=$2;shift;;
e8755431a0cd fixed missing dependencies
saskia-hiltemann
parents: 1
diff changeset
18 --galaxypath) galaxypath=$2;shift;;
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 --minwidth) minwidth=$2;shift;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 --tab) tabs+=",$2";shift;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 --htmlout) htmlout=$2;shift;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 --label) title="$@";shift;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 --coverimage) coverimage=$2;shift;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 -h) shift;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 --) shift;break;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 -*) usage;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 *) break;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 esac
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 shift
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34
3
4a6ebda2a3ae fixed tool dependency issue
saskia-hiltemann
parents: 2
diff changeset
35 source "${repositorypath}/createHTML.sh"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 mkdir $galaxypath
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 items=${items//,/ }; items=${items/ /}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
44
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 title=${title//--/}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
55
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
56 reportname=${title// /}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
57
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 echo -e "\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 echo -e "title: $title"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 echo -e "tabs: $tabs"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 echo -e "items: $items"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 echo -e "htmlout: $htmlout"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 echo -e "\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 for i in $tabs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 echo "tabname: $i"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
73
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 3
diff changeset
86 ## Copy supporting files from repository to output directory
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 cp ${repositorypath}/jquery.dataTables.css ${galaxypath}/jquery.dataTables.css
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 cp ${repositorypath}/jquery.zoom.js ${galaxypath}/jquery.zoom.js
1
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
92 cp ${repositorypath}/jquery-ui.css ${galaxypath}/jquery-ui.css
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
93 cp ${repositorypath}/jquery-1.10.2.js ${galaxypath}/jquery-1.10.2.js
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
94 cp ${repositorypath}/jquery-ui.js ${galaxypath}/jquery-ui.js
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 3
diff changeset
95 cp ${repositorypath}/md.css ${galaxypath}/md.css
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 3
diff changeset
96 cp ${repositorypath}/ireport_css.css ${galaxypath}/ireport_css.css
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 3
diff changeset
97 cp ${repositorypath}/ireport_jquery.js ${galaxypath}/ireport_jquery.js
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 echo "done copying resource files"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100 ls ${galaxypath}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103 ## Create cover HTML page
1
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
104 makeIntroPage "$title" $coverimage "report.html" $htmlout iReport_${reportname}.zip
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
105
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
106 ## Create copy of cover page for downloadable version
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
107 makeIntroPage "$title" $coverimage "report.html" coverpage.html iReport_${reportname}.zip
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
108 cp coverpage.html ${galaxypath}/coverpage.html
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
109
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
112
1
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
113
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
114 ## Create zip file of this iReport for download by user
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
115 wd=`pwd`
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
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
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
118 cd $wd
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
119
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
120 wait