6
|
1 #!/bin/bash
|
|
2
|
|
3
|
|
4 echo "allparams: $@"
|
|
5 function usage() { echo "Oops!"; }
|
|
6
|
|
7
|
|
8 # set some defaults
|
|
9
|
|
10 gbcount=0
|
|
11 set -- `getopt -n$0 -u -a --longoptions="ifusepath: galaxypath: tab: item: genomebrowsertrack: newgb: htmlout: label: toolpath: minwidth: coverimage:" "h:" "$@"` || usage
|
|
12 [ $# -eq 0 ] && usage
|
|
13
|
|
14 while [ $# -gt 0 ]
|
|
15 do
|
|
16 case "$1" in
|
|
17 --toolpath) repositorypath=$2;shift;;
|
|
18 --galaxypath) galaxypath=$2;shift;;
|
|
19 --minwidth) minwidth=$2;shift;;
|
|
20 --tab) tabs+=",$2";shift;;
|
|
21 --item) items+=",$2";shift;;
|
|
22 --newgb) gbcount=$[$gbcount+1];shift;;
|
|
23 --genomebrowsertrack) gbtracks+=",${gbcount}:$2";shift;;
|
|
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
|
|
35 source "${repositorypath}/createHTML.sh"
|
|
36 mkdir $galaxypath
|
|
37
|
|
38 #tabs=${tabs//,/ }; tabs=${tabs/ /}
|
|
39 #tabs=${tabs//==dollar==/$}
|
|
40 #tabs=${tabs//==braceopen==/(}
|
|
41 #tabs=${tabs//==braceclose==/)}
|
|
42 gbtracks=${gbtracks:1}
|
|
43 items=${items//,/ }; items=${items/ /}
|
|
44
|
|
45 title=${title//--/}
|
|
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%--*}
|
|
55
|
|
56 reportname=${title// /}
|
|
57
|
|
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"
|
|
64 echo -e "gbtracks: ${gbtracks[@]}"
|
|
65 echo -e "gbcount: ${gbcount}"
|
|
66 echo -e "\n"
|
|
67
|
|
68 for i in $tabs
|
|
69 do
|
|
70 echo "tabname: $i"
|
|
71 done
|
|
72
|
|
73
|
|
74
|
|
75 #if no coverimage provided, use default EMC logo
|
|
76 if [[ $coverimage == "-" ]]
|
|
77 then
|
|
78 cp $repositorypath/intro.jpg ${galaxypath}/intro.jpg
|
|
79 coverimage="intro.jpg"
|
|
80 else
|
|
81 coverimage=${coverimage:1}
|
|
82 echo -n "$coverimage" > tmpfileb64
|
|
83 coverimage=`base64 -d tmpfileb64`
|
|
84 fi
|
|
85
|
|
86 ## Copy supporting files from repository to output directory
|
|
87 cp ${repositorypath}/jquery.dataTables.css ${galaxypath}/jquery.dataTables.css
|
|
88 cp ${repositorypath}/jquery.dataTables.js ${galaxypath}/jquery.dataTables.js
|
|
89 cp -R ${repositorypath}/iframe-resizer/ ${galaxypath}/iframe-resizer/ > /dev/null 2>&1
|
|
90 cp -R ${repositorypath}/DataTables-1.9.4/ ${galaxypath}/DataTables-1.9.4/ > /dev/null 2>&1
|
|
91 cp ${repositorypath}/jquery.zoom.js ${galaxypath}/jquery.zoom.js
|
|
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
|
|
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
|
|
98
|
|
99 echo "done copying resource files"
|
|
100 ls ${galaxypath}
|
|
101
|
|
102
|
|
103 ## Create cover HTML page
|
|
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
|
|
109
|
|
110 ## Create Report page with tabs
|
|
111 createMainPage ${galaxypath}/report.html "$tabs" "$items" $minwidth "$gbtracks"
|
|
112
|
|
113
|
|
114 ## Create zip file of this iReport for download by user
|
|
115 wd=`pwd`
|
|
116 cd ${galaxypath}
|
|
117 zip -r iReport_${reportname} . > /dev/null 2>&1
|
|
118 cd $wd
|
|
119
|
|
120 wait |