annotate createHTML.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
1 gbcount=0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
2
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
3 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
4 ## Create Cover Page
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
5 ##
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
6 #<a href=\"$zipireport\"> Click here to download a copy of this iReport </a> <br/><br/>
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 function makeIntroPage ( ){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 echo "Creating Intro Page"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 title="$1"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 coverimage=$2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 link=$3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 htmlout=$4
1
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
13 zipireport=$5
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 echo -e "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 <html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 <head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 </head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 <body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 <br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 <br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 <center>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 <b><font size=\"15\"> iReport: ${title} </font></b><br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 <br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 <br/>
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
26 <a href=\"$link\"> Click image to view report </a> <br/><br/>
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 <a href=\"$link\"> <img src="$coverimage" width=\"50%\" alt=\"loading image..\"/> </a><br/><br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 </center>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 </body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 </html>" > $htmlout
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
34 ##
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
35 ## Decompress archive fiels
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
36 ## -> will detect archive formats: zip, tar, gzip, tar.gz, bzip2
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
37 ## -> input: path to archive
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
38 ## -> files will be located in ${galaxypath}/archive_${fname}/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
39 ##
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
40 function decompressArchive (){
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
41 archive=$1
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
42
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
43 fname=`basename ${archive}`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
44 fname=${fname%.dat}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
45 ftype=`file $archive`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
46
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
47 if [[ ! -d ${galaxypath}/archive_${fname}/ ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
48 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
49 mkdir ${galaxypath}/archive_${fname}/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
50
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
51 #echo "archive type: `file $archive`"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
52 # decompress archive
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
53 if [[ $ftype == *Zip* ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
54 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
55 #echo "detected zip file"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
56 cp $archive ${galaxypath}/archive_${fname}/${fname}.zip
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
57 wd=`pwd`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
58 cd ${galaxypath}/archive_${fname}/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
59 unzip -q ${fname}.zip
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
60 rm ${fname}.zip
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
61 cd $wd
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
62 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
63 if [[ $ftype == *tar* ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
64 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
65 cp $archive ${galaxypath}/archive_${fname}/${fname}.tar
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
66 wd=`pwd`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
67 cd ${galaxypath}/archive_${fname}/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
68 tar xf ${fname}.tar
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
69 rm ${fname}.tar
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
70 cd $wd
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
71 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
72 if [[ $ftype == *gzip* ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
73 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
74 cp $archive ${galaxypath}/archive_${fname}/${fname}.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
75 gunzip ${galaxypath}/archive_${fname}/${fname}.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
76 #ls ${galaxypath}/archive_${fname}/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
77
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
78 # check for tar.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
79 ftype=`file ${galaxypath}/archive_${fname}/${fname}`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
80 if [[ $ftype == *tar* ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
81 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
82 # turns out it was tar.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
83 rm -Rf ${galaxypath}/archive_${fname}/*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
84 ls ${galaxypath}/archive_${fname}/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
85 cp $archive ${galaxypath}/archive_${fname}/${fname}.tar.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
86
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
87 wd=`pwd`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
88 cd ${galaxypath}/archive_${fname}/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
89 tar xzf ${fname}.tar.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
90 cd $wd
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
91 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
92 wait
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
93 rm -f ${galaxypath}/archive_${fname}/*.tar
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
94 rm -f ${galaxypath}/archive_${fname}/*.tar.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
95 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
96 if [[ $ftype == *bzip2* ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
97 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
98 cp $archive ${galaxypath}/archive_${fname}/${fname}.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
99 gunzip2 ${galaxypath}/archive_${fname}/${fname}.gz
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
100 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
101 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
102 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
103
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
104 ##
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
105 ## Create HTML content for the tabs specified by user
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
106 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107 function makeTabContent ( ){
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
108 tab=$1 # name of current tab
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
109 itemslist=$2 # list of all items
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
110 tracklist=$3 # genome browser tracks info
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
111 contentline="" # HTML code for tab
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
112 imgcount=0 # keep track of the number of images on the current tab
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
113 iframename=`head -n 1 < /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
114 #iframename="test"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
115 for item in $itemslist
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
116 do
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
117 ## Parse items lists
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
118 item=${item/::/:emptycol:}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
119 declare -a myarr=(`echo $item |sed 's/:/ /g'`)
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
120
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
121 ## Create the tab contents HTML code
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
122 if [ ${myarr[0]} == $tab ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
123 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
124
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
125 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
126 ## Text Field
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
127 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
128 if [ ${myarr[1]} == "text" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
129 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
130 text=${myarr[2]}
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
131 md=${myarr[4]}
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
132
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
133 # if markdown, convert to html
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
134 if [ $md == "Y" ]
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
135 then
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
136 ## resubstitute sanitized charachters
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
137 text=${text//==space==/ }
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
138 text=${text//==colon==/:}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
139 text=${text//==comma==/,}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
140
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
141 text=${text//==braceopen==/(}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
142 text=${text//==braceclose==/)}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
143 text=${text//==cbraceopen==/{}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
144 text=${text//==cbraceclose==/&#125;}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
145
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
146 text=${text//==slash==/\/}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
147 text=${text//==lt==/<}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
148 text=${text//==gt==/>}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
149 text=${text//==apos==/\'}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
150 text=${text//==quote==/\"}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
151 text=${text//==backtick==/\`}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
152 text=${text//==dollar==/$}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
153 text=${text//==bar==/|}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
154 text=${text//&&/&}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
155 text=${text//\\n/\\n}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
156 text=${text//\\t/\\t}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
157 text=${text//\&r\&n/\\n}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
158 text=${text//\&r/\\n}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
159 text=${text//\&n/\\n}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
160 text=${text//\&c/:}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
161
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
162
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
163 ## convert markdown in textfield to html
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
164 echo -e "$text" > mytext.md
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
165
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
166 if [ -z `type -p pandoc` ]
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
167 then
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
168 # pandoc missing
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
169 ${repositorypath}/Markdown/markdown2.py mytext.md > mytext.html
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
170
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
171 else
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
172 # pandoc exists
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
173 pandoc -f markdown -o mytext.html mytext.md
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
174 pandoc -f markdown -o standalone.html -s mytext.md
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
175
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
176 #get css generated by pandoc and add as scoped attribute (HTML5)
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
177 pandocstyle=`sed -n '/<style/,/style>/p' standalone.html`
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
178 fi
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
179
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
180 markdowntext=$(cat mytext.html)
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
181 contentline="${contentline}\n<div class=\"markdown-body\">${pandocstyle} ${markdowntext}</div>\n"
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
182
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
183 else # If not markdown, print verbatim (with exception of few html tags)
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
184
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
185 ## allow some html formatting tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
186 text=${text//==lt==strong==gt==/<strong>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
187 text=${text//==lt====slash==strong==gt==/<\/strong>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
188 text=${text//==lt==em==gt==/<em>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
189 text=${text//==lt====slash==em==gt==/<\/em>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
190
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
191 text=${text//==lt==b==gt==/<strong>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
192 text=${text//==lt====slash==b==gt==/<\/strong>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
193 text=${text//==lt==i==gt==/<em>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
194 text=${text//==lt====slash==i==gt==/<\/em>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
195
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
196 text=${text//==lt==br==gt==/<br\/>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
197 text=${text//==lt====br==slash==gt==/<br\/>} # search for strong tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
198 text=${text//==lt==h1==gt==/<h1>} # search for h1-h6 tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
199 text=${text//==lt==h2==gt==/<h2>} # search for h1-h6 tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
200 text=${text//==lt==h3==gt==/<h3>} # search for h1-h6 tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
201 text=${text//==lt==h4==gt==/<h4>} # search for h1-h6 tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
202 text=${text//==lt==h5==gt==/<h5>} # search for h1-h6 tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
203 text=${text//==lt==h6==gt==/<h6>} # search for h1-h6 tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
204 text=${text//==lt====slash==h1==gt==/<\/h1>} # search for h1-h6 closing tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
205 text=${text//==lt====slash==h2==gt==/<\/h2>} # search for h1-h6 closing tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
206 text=${text//==lt====slash==h3==gt==/<\/h3>} # search for h1-h6 closing tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
207 text=${text//==lt====slash==h4==gt==/<\/h4>} # search for h1-h6 closing tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
208 text=${text//==lt====slash==h5==gt==/<\/h5>} # search for h1-h6 closing tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
209 text=${text//==lt====slaxh==h6==gt==/<\/h6>} # search for h1-h6 closing tags
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
210
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
211 ## display everything else verbatim
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
212 text=${text//==space==/ }
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
213 text=${text//==colon==/:}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
214 text=${text//==comma==/,}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
215 text=${text//==slash==/\/}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
216 text=${text//==lt==/&lt;}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
217 text=${text//==gt==/&gt;}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
218 text=${text//==apos==/&apos;}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
219 text=${text//==quote==/&quot;}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
220 text=${text//&&/&amp;}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
221 text=${text//\\n/<br/>}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
222 text=${text//\\t/&emsp;}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
223 text=${text//\&r\&n/<br/>}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
224 text=${text//\&r/<br/>}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
225 text=${text//\&n/<br/>}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
226 text=${text//\&c/:}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
227 text=${text//==backtick==/&#96;}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
228 text=${text//==dollar==/$}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
229 text=${text//==bar==/|}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
230 text=${text//==braceopen==/(}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
231 text=${text//==braceclose==/)}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
232 text=${text//==cbraceopen==/{}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
233 text=${text//==cbraceclose==/&#125;}
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
234 contentline="${contentline}\n${text}\n"
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
235 fi
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
236
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
237
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
238 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
239
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
240 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
241 ## Text File
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
242 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
243 if [ ${myarr[1]} == "textfile" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
244 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
245 tfile=${myarr[2]}
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
246 md=${myarr[4]}
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
247 fname=`basename ${tfile}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
248 fname=${fname%.*}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
249 fname="${fname}.txt"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
250 cp ${tfile} "${galaxypath}/${fname}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
251
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
252 #estimate height for iframe based on number oflines in the file
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
253 numlines=`wc -l ${tfile} | cut -d" " -f1`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
254 minheight=$[$numlines*17]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
255
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
256 # if markdown, convert to html
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
257 if [ $md == "Y" ]
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
258 then
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
259
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
260 if [ -z `type -p pandoc` ]
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
261 then
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
262 # pandoc missing
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
263 ${repositorypath}/Markdown/markdown2.py ${tfile} > mytext.html
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
264
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
265 else
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
266 # pandoc exists
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
267 pandoc -o mytext.html ${tfile}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
268 pandoc -o standalone.html -s ${tfile}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
269
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
270 # get css generated by pandoc and add as scoped attribute (HTML5)
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
271 pandocstyle=`sed -n '/<style/,/style>/p' standalone.html`
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
272
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
273 fi
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
274
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
275 markdowntext=$(cat mytext.html)
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
276 contentline="${contentline}\n<div class=\"markdown-body\">${pandocstyle} ${markdowntext}</div>\n"
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
277 else
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
278 contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${fname}\" width=\"100%\" height=\"$minheight\"> </iframe>\n"
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
279 fi
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
280 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
281
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
282 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
283 ## Image
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
284 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
285 if [ ${myarr[1]} == "image" ]
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
286
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
287 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
288 imgcount=$[$imgcount+1]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
289 #restore file suffix for html
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
290 ftype=`file ${myarr[2]}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
291 zoomlevel=${myarr[4]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
292 zoomenable=${myarr[5]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
293 align=${myarr[6]}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
294 typestring=""
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
295 #####echo "zoomenable:${zoomenable}, align:${align}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
296 if [[ $ftype == *JPEG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
297 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
298 suffix=".jpg"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
299 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
300 if [[ $ftype == *SVG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
301 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
302 suffix=".svg"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
303 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
304 if [[ $ftype == *PNG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
305 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
306 suffix=".png"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
307 fi
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
308 if [[ $ftype == *TIFF* ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
309 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
310 suffix=".tiff"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
311 typestring="type=\"image/tiff\""
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
312 fi
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
313
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
314 image=`basename ${myarr[2]}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
315 image=${image%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
316 image="${image}${suffix}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
317 cp ${myarr[2]} ${galaxypath}/${image}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
318
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
319 if [[ ${align} == "none" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
320 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
321 alignstring=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
322 alignstring2=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
323 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
324 alignstring="<div float=\"${align}\">"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
325 alignstring2="</div>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
326
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
327 alignstring="align=\"${align}\""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
328 alignstring2=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
329 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
330
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
331
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
332 if [[ ${zoomlevel} -eq 0 ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
333 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
334 widthstring=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
335 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
336 widthstring="width=\"${zoomlevel}\""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
337 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
338
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
339 if [[ ${zoomlevel} -eq 0 || ${zoomenable} == "N" ]]
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
340 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
341 contentline="${contentline}<span id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
342 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
343 contentline="${contentline}<span class=\"zoomme\" id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
344 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
345
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
346 fi
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
347
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
348 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
349 ## Table
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
350 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
351 if [ ${myarr[1]} == "table" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
352 then
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
353
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
354 maxlines=50000
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
355 tsvfile_orig=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
356 tsvfile="tablehead.tsv"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
357 fname=`basename ${tsvfile_orig}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
358 fname=${fname%.*}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
359 fancy=${myarr[4]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
360 makelinks=${myarr[5]}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
361 #iframeid="iframe$giframecount"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
362 iframeid="iframe-$iframename"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
363
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
364 #echo "\nmakelinks: $makelinks fancy: $fancy <br>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
365
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
366 #TODO client side database for large files. For now only display first section of file and add download link
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
367 numlines=`wc -l ${tsvfile_orig} |cut -d" " -f1`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
368
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
369 head -${maxlines} ${tsvfile_orig} > tsvtmpfile
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
370
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
371 #remove any empty or header lines (lines starting with #, unless vcf file, then keep #CHROM line)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
372 awk 'BEGIN{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
373 FS="\t"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
374 OFS="\t"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
375 }{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
376 if((index($0,"#")==1 && index($0,"#CHROM")!=1) || $0==""){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
377 headerlines++
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
378 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
379 else print $0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
380
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
381 }END{}' tsvtmpfile > ${tsvfile}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
382
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
383 if [[ $makelinks == "Y" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
384 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
385 col=${myarr[6]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
386 prefix=${myarr[7]}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
387 suffix=${myarr[8]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
388 urlitems=${myarr[9]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
389 minw=${myarr[10]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
390 minh=${myarr[11]}
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
391 suffix=${suffix/emptycol/}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
392 suffix=${suffix/==quote==/&}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
393 prefix=${prefix/emptycol/}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
394 prefix=${prefix/==quote==/&}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
395 prefix=${prefix/==colon==/:}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
396
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
397 # unpack archive of files to link to if present
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
398 if [[ ${urlitems} != None ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
399 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
400 oldfname=$fname
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
401 decompressArchive ${urlitems}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
402 prefix=archive_${fname}/${prefix}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
403 fname=$oldfname
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
404 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
405
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
406
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
407 #edit the table to include links
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
408 awk 'BEGIN{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
409 FS="\t"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
410 OFS="\t"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
411 url="'"$prefix"'"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
412 url2="'"$suffix"'"
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
413 iframeid="'"$iframeid"'"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
414 prefix="<a href=\42"
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
415 suffix="\42 onclick=\42resizeIframe("iframeid")\42>"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
416 col="'"$col"'"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
417 end="</a>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
418 }{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
419 if(FNR==1)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
420 print $0
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
421 else{
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
422 $col=prefix""url""$col""url2""suffix""$col""end
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
423 print $0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
424 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
425 }END{}' ${tsvfile} > ${tsvfile}2
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
426
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
427 else
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
428 minw=${myarr[6]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
429 minh=${myarr[7]}
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
430 cp ${tsvfile} ${tsvfile}2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
431 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
432
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
433 #iframecount=$[$iframecount+1]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
434
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
435 if [ $fancy == "Y" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
436 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
437 perl ${repositorypath}/tsv2html.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
438 contentline="${contentline}\n<iframe class=\"invisibleframe fancyiframe\" id=\"$iframeid\" src=\"htmltable_${fname}.html\" width=\"100%\" style=\"height: 350px; min-height: ${minh}px !important; overflow-y: hidden; overflow-x: scroll\" onClick=resizeIframe(\"$iframeid\")></iframe>"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
439
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
440 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
441 perl ${repositorypath}/tsv2html_simple.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
442 contentline="${contentline}\n<iframe class=\"unfancyiframe invisibleframe\" id=\"$iframeid\" src=\"htmltable_${fname}.html\" scrolling=\"no\" style=\"min-width: ${minw}px; min-height: ${minh}px !important; max-width: 100%; vertical-align: top;\" onClick=resizeIframe(\"$iframeid\") ></iframe>"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
443
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
444 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
445
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
446 if [[ $numlines -gt ${maxlines} ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
447 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
448 tablename=`basename ${tsvfile_orig}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
449 cp ${tsvfile_orig} ${galaxypath}/$tablename
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
450 contentline="${contentline}<br/>\nLarge tables will be supported soon. The first ${maxlines} lines are shown here, and you can download the full file <a href=\"${tablename}\">here</a>."
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
451 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
452 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
453
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
454 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
455 ## PDF
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
456 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
457 if [[ ${myarr[1]} == "pdf" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
458 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
459 pdffile=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
460 fname=`basename ${pdffile}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
461 fname=${fname%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
462 pdfname="${fname}.pdf"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
463 cp ${pdffile} "${galaxypath}/${pdfname}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
464
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
465 width=1000
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
466 height=800
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
467 echo -e "<html><body><object data=\"${pdfname}\" type=\"application/pdf\" width=\"$width\" height=\"$height\"><embed src=\"${pdfname}\" type=\"application/pdf\" /><p>It appears you have no PDF plugin for your browser. No biggie... you can <a href=\"${pdfname}\">click here to download the PDF file.</a></p></object></body></html>" > "${galaxypath}/${fname}.html"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
468 width=$[$width+10]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
469 height=$[$height+10]
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
470 contentline="${contentline}\n<iframe src=\"${fname}.html\" width=\"${width}\" height=\"${height}\"></iframe>\n"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
471
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
472 fi
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
473
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
474 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
475 ## HTML
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
476 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
477 if [[ ${myarr[1]} == "htmlfile" ]]
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
478 then
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
479 htmlfile=${myarr[2]}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
480 height=${myarr[4]}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
481 fname=`basename ${htmlfile}`
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
482 fname=${fname%.dat}
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
483 htmlname="${fname}.html"
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
484 cp ${htmlfile} "${galaxypath}/${htmlname}"
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
485
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
486 apiid=${myarr[5]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
487 isireport=${myarr[6]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
488 localhost=${myarr[7]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
489 proxy=${myarr[8]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
490 localhost=${localhost//==colon==/:}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
491 localhost=${localhost//==fslash==/\/}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
492 if [[ ${isireport} == "Y" ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
493 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
494 #cp ${localhost}/datasets/${apiid}/* "${galaxypath}/tst"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
495 htmlname="/${proxy}/datasets/${apiid}/display/"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
496 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
497
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
498 contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${htmlname}\" width=\"100%\" height=\"${height}px\"></iframe>\n"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
499 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
500
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
501
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
502 if [[ ${myarr[1]} == "htmlpage" ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
503 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
504 url=${myarr[2]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
505 url=${url//==colon==/:}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
506 url=${url//==fslash==//}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
507 height=${myarr[4]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
508 contentline="${contentline}\n<iframe class=\"invisibleframe\" src=\"${url}\" width=\"100%\" height=\"${height}px\"></iframe>\n"
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
509 fi
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
510
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
511 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
512 ## Web Link
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
513 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
514 if [ ${myarr[1]} == "weblink" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
515 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
516 url=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
517 linktext=${myarr[4]}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
518
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
519 echo -n "$url" > tmpfileb64
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
520 url=`base64 -d tmpfileb64`
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
521
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
522 echo -n "$linktext" > tmpfileb64
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
523 linktext=`base64 -d tmpfileb64`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
524
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
525 if [[ -z $linktext ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
526 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
527 linktext=$url
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
528 fi
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
529 contentline="${contentline}<a href=\"${url}\" target=\"_blank\">${linktext}</a>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
530 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
531
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
532
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
533 ##
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
534 ## Genome Browser
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
535 ##
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
536 if [ ${myarr[1]} == "genomebrowser" ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
537 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
538
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
539 # parse inputs
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
540
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
541 apiid=${myarr[4]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
542 servername=${myarr[5]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
543 buildver=${myarr[2]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
544
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
545
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
546 region=${myarr[6]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
547
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
548
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
549 echo -n "$region" > tmpfileb64
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
550 region=`base64 -d tmpfileb64`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
551
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
552
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
553 initialchrom=${region%:*}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
554 initialrange=${region#*:}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
555
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
556 initialstart=${initialrange%-*}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
557 initialend=${initialrange#*-}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
558
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
559
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
560 #TODO
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
561 ftype="vcf"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
562
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
563 servername=${servername/==colon==/:}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
564
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
565 ## parse and prepare all tracks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
566 gbcount=$[$gbcount+1]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
567 gbfilelist=${tracklist}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
568 userTracks=""
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
569 #IFS=',' read -a gbfilearray <<< ${gbfilelist}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
570 gbfilearray=(${gbfilelist//,/ })
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
571 for gbfile in "${gbfilearray[@]}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
572 do
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
573 # gbfile is in format "browsernum:file"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
574 #IFS=':' read -a gbfileinfo <<< ${gbfile}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
575 gbfileinfo=(${gbfile//:/ })
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
576 if [[ ${gbfileinfo[0]} == $gbcount ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
577 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
578
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
579 ftype=${gbfileinfo[3]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
580
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
581 gbfilename=${gbfileinfo[1]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
582 gbfilelabel=${gbfileinfo[2]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
583 gbfilelabel=${gbfilelabel//==space==/ }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
584 gbfilelabel=${gbfilelabel//==bopen==/(}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
585 gbfilelabel=${gbfilelabel//==bclose==/)}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
586 fname=`basename ${gbfilename}`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
587 fname=${fname%.dat}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
588
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
589 if [[ $ftype == "vcftabix" ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
590 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
591 newgbfilename="${fname}.vcf"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
592
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
593
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
594 cp ${gbfilename} "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
595 bgzip "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
596 tabix -f -p vcf "${galaxypath}/${newgbfilename}.gz"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
597
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
598 userTracks="${userTracks},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
599 {name: '${gbfilelabel}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
600 uri: '${servername}/datasets/${apiid}/display/${newgbfilename}.gz',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
601 tier_type: 'tabix',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
602 payload: 'vcf'}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
603 "
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
604 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
605
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
606 if [[ $ftype == "vcfmemstore" ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
607 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
608 newgbfilename="${fname}.vcf"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
609
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
610
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
611 cp ${gbfilename} "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
612 #bgzip "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
613 #tabix -p vcf "${galaxypath}/${newgbfilename}.gz"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
614
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
615 userTracks="${userTracks},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
616 {name: '${gbfilelabel}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
617 uri: '${servername}/datasets/${apiid}/display/${newgbfilename}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
618 tier_type: 'memstore',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
619 payload: 'vcf'}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
620 "
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
621 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
622
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
623 if [[ $ftype == "bam" ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
624 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
625 newgbfilename="${fname}.bam"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
626
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
627 # link to bam instead of copying
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
628 ln -s ${gbfilename} "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
629 samtools index "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
630
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
631 userTracks="${userTracks},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
632 {name: '${gbfilelabel}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
633 bamURI: '${servername}/datasets/${apiid}/display/${newgbfilename}'}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
634 "
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
635
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
636 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
637
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
638 if [[ $ftype == "bigbed" ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
639 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
640 newgbfilename="${fname}.bigbed"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
641
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
642 cp ${gbfilename} "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
643 #bgzip "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
644 #tabix -f -p bed "${galaxypath}/${newgbfilename}.gz"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
645
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
646 userTracks="${userTracks},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
647 {name: '${gbfilelabel}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
648 bwgURI: '${servername}/datasets/${apiid}/display/${newgbfilename}'}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
649 "
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
650
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
651 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
652
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
653 if [[ $ftype == "bedtabix" ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
654 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
655 newgbfilename="${fname}.bed"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
656
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
657 cp ${gbfilename} "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
658 bgzip "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
659 tabix -f -p bed "${galaxypath}/${newgbfilename}.gz"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
660
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
661 userTracks="${userTracks},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
662 {name: '${gbfilelabel}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
663 uri: '${servername}/datasets/${apiid}/display/${newgbfilename}.gz',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
664 tier_type: 'tabix',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
665 payload: 'bed'}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
666 "
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
667
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
668 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
669
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
670 if [[ $ftype == "bedmemstore" ]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
671 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
672 newgbfilename="${fname}.bed"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
673
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
674 cp ${gbfilename} "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
675 #bgzip "${galaxypath}/${newgbfilename}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
676 #tabix -p bed "${galaxypath}/${newgbfilename}.gz"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
677
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
678 userTracks="${userTracks},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
679 {name: '${gbfilelabel}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
680 uri: '${servername}/datasets/${apiid}/display/${newgbfilename}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
681 tier_type: 'memstore',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
682 payload: 'bed'}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
683 "
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
684
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
685 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
686 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
687 done
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
688
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
689
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
690
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
691 if [ ${buildver} == "hg18" ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
692 then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
693 coordSystem="coordSystem: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
694 speciesName: 'Human',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
695 taxon: 9606,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
696 auth: 'NCBI',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
697 version: '36',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
698 ucscName: 'hg18'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
699 },"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
700
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
701 chains="chains: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
702 hg19ToHg18: new Chainset('https://www.biodalliance.org/das/hg19ToHg18/', 'GRCh37', 'NCBI36',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
703 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
704 speciesName: 'Human',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
705 taxon: 9606,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
706 auth: 'GRCh',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
707 version: 37
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
708 })
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
709 },"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
710
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
711 genesTrack="{name: 'Genes',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
712 desc: 'Gene structures from Ensembl 54',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
713 uri: 'https://www.biodalliance.org/das/hsa_54_36p/',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
714 collapseSuperGroups: true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
715 provides_karyotype: true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
716 provides_search: true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
717 provides_entrypoints: true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
718 maxbins: false}, "
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
719
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
720 repeatsTrack="{name: 'Repeats',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
721 desc: 'Repeat annotation from Ensembl 59',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
722 bwgURI: 'https://www.biodalliance.org/datasets/repeats.bb',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
723 stylesheet_uri: 'https://www.biodalliance.org/stylesheets/bb-repeats.xml'}"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
724
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
725
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
726 # default is hg19
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
727 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
728 coordSystem="coordSystem: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
729 speciesName: 'Human',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
730 taxon: 9606,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
731 auth: 'NCBI',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
732 version: '37',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
733 ucscName: 'hg19'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
734 },"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
735
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
736 chains=""
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
737
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
738 genesTrack="{name: 'Genes',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
739 desc: 'Gene structures from GENCODE 19',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
740 bwgURI: 'https://www.biodalliance.org/datasets/gencode.bb',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
741 stylesheet_uri: 'https://www.biodalliance.org/stylesheets/gencode.xml',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
742 collapseSuperGroups: true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
743 trixURI: 'https://www.biodalliance.org/datasets/geneIndex.ix'},"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
744
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
745 repeatsTrack="{name: 'Repeats',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
746 desc: 'Repeat annotation from Ensembl 59',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
747 bwgURI: 'https://www.biodalliance.org/datasets/repeats.bb',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
748 stylesheet_uri: 'https://www.biodalliance.org/stylesheets/bb-repeats.xml'},"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
749
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
750 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
751
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
752 contentline="${contentline}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
753 <script language=\"javascript\" src=\"https://www.biodalliance.org/release-0.13/dalliance-compiled.js\"></script>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
754 <script language=\"javascript\">
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
755 new Browser({
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
756 chr: '$initialchrom',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
757 viewStart: $initialstart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
758 viewEnd: $initialend,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
759 cookieKey: 'human',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
760 pageName: 'svgHolder${gbcount}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
761 ${coordSystem}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
762
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
763 ${chains}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
764 sources: [{name: 'Genome',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
765 twoBitURI: 'https://www.biodalliance.org/datasets/${buildver}.2bit',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
766 tier_type: 'sequence'},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
767 ${genesTrack},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
768 ${repeatsTrack},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
769 {name: 'Conservation',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
770 desc: 'Conservation',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
771 bwgURI: 'https://www.biodalliance.org/datasets/phastCons46way.bw',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
772 noDownsample: true}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
773 ${userTracks}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
774 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
775
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
776
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
777
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
778
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
779 browserLinks: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
780 Ensembl: 'http://www.ensembl.org/Homo_sapiens/Location/View?r=${chr}:${start}-${end}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
781 UCSC: 'http://genome.ucsc.edu/cgi-bin/hgTracks?db=${buildver}&position=chr${chr}:${start}-${end}',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
782 Sequence: 'http://www.derkholm.net:8080/das/${buildver}comp/sequence?segment=${chr}:${start},${end}'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
783 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
784
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
785 });
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
786 </script>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
787
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
788 <div id=\"svgHolder${gbcount}\"></div>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
789 "
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
790 fi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
791
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
792 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
793 ## Link to Dataset
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
794 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
795 if [ ${myarr[1]} == "link" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
796 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
797 linkfile=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
798 apiid=${myarr[4]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
799 isireport=${myarr[5]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
800 linkfilename=`basename ${linkfile}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
801 linktext=${myarr[6]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
802
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
803 localhost=${myarr[7]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
804 proxy=${myarr[8]}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
805 localhost=${localhost//==colon==/:}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
806 localhost=${localhost//==fslash==/\/}
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
807
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
808 #check for some basic filetypes
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
809 ftype=`file $linkfile`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
810 if [[ $ftype == *HTML* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
811 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
812 linkfilename=${linkfilename%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
813 linkfilename=${linkfilename}.html
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
814 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
815 if [[ $ftype == *PNG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
816 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
817 linkfilename=${linkfilename%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
818 linkfilename=${linkfilename}.png
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
819 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
820 if [[ $ftype == *SVG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
821 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
822 linkfilename=${linkfilename%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
823 linkfilename=${linkfilename}.svg
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
824 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
825 if [[ $ftype == *JPEG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
826 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
827 linkfilename=${linkfilename%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
828 linkfilename=${linkfilename}.jpg
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
829 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
830
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
831
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
832 if [[ ${isireport} == "Y" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
833 then
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
834 linkfilename="/${proxy}/datasets/${apiid}/display/"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
835 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
836 cp ${linkfile} "${galaxypath}/${linkfilename}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
837 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
838
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
839 contentline="${contentline}<a href=\"${linkfilename}\">${linktext}</a>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
840 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
841
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
842 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
843 ## Links to Archive Contents
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
844 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
845 if [[ ${myarr[1]} == "links" ]]
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
846 then
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
847 archive=${myarr[2]}
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
848 decompressArchive $archive
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
849
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
850 # add links to webpage
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
851 # separate line for each folder, files within folder on same line
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
852 for linkfile in `ls ${galaxypath}/archive_${fname}/ |sort -V`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
853 do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
854 #echo "<br/> ->making link to file: $linkfile "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
855 if [ -d ${galaxypath}/archive_${fname}/$linkfile ] # if directory, add break, and list all contained files, max level 1 deep
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
856 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
857 #echo "<br/> ->is directory, entering: $linkfile "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
858 #ls ${galaxypath}/archive_${fname}/$linkfile
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
859 contentline="${contentline}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
860 for linkfile2 in `ls ${galaxypath}/archive_${fname}/$linkfile | sort -V`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
861 do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
862 #echo "<br/> ->making link to file: ${galaxypath}/archive_${fname}/$linkfile2"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
863 if [ -f ${galaxypath}/archive_${fname}/$linkfile/$linkfile2 ] # if directory, add break, and list all contained files, max level 1 deep
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
864 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
865 #echo "<br/> ->is file, making link: $linkfile "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
866 label=`basename $linkfile2`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
867 label=${label%.*}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
868 contentline="${contentline}<a class=\"mylinks\" href=\"archive_${fname}/${linkfile}/${linkfile2}\">${label}</a>&nbsp;\n "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
869 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
870 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
871 elif [ -f ${galaxypath}/archive_${fname}/$linkfile ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
872 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
873 label=`basename ${galaxypath}/archive_${fname}/$linkfile`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
874 label=${label%.*}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
875 contentline="${contentline}<a class=\"mylinks\" href=\"archive_${fname}/${linkfile}\">$label</a>&nbsp;\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
876 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
877 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
878
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
879
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
880 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
881
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
882 if [[ ${myarr[3]} == "Y" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
883 then
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
884 contentline="${contentline}<br/>\n"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
885 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
886 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
887 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
888
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
889 echo "${contentline}"
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
890
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
891
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
892 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
893
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
894 ##
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
895 ## Create HTML content for iReport
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
896 ##
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
897 createMainPage (){
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
898 #export IFRAMECNT=1
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
899 page=$1
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
900 tabtitles=$2 # comma-separated list of tab titles
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
901 tabitems=$3 # colon-sparated list of tabs specifications
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
902 #giframecount=1 # keep track of number of iFrames so that they can be referenced by ID
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
903 minwidth=$4 # width of page
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
904 gbtracks=$5 # genome browser track information
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
905
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
906 echo "createMainPage: tabitems: $tabitems. tabtitles: $tabtitles. gbtracks: $gbtracks"
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
907 # create correct number of tabs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
908 count=0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
909
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
910 tabtitles=${tabtitles/,/}
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
911 tabtitles=${tabtitles//,/ }
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
912 echo $tabtitles
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
913
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
914 tabcount=0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
915 for tabt in $tabtitles
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
916 do
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
917 echo -n $tabt > tmpfileb64
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
918 thistabtitle=`base64 -d tmpfileb64`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
919 newtabtitles+=" $thistabtitle"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
920 tabcount=$[tabcount+1]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
921 done
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
922
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
923 echo $newtabtitles
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
924
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
925 tabslist="<ul>\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
926 mytabs=""
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
927
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
928 for title in $newtabtitles
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
929 do
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
930 # Create list of tabs
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
931 count=$[count+1]
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
932 title2=${title//==space==/ }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
933 title2=${title2//==dollar==/$}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
934 title2=${title2//==colon==/}
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
935 tabslist="${tabslist} <li><a href=\"#tabs-${count}\">${title2}</a></li>\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
936
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
937 # Create tabs with content
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
938 tabcontent=$(makeTabContent $title "$tabitems" "$gbtracks")
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
939 mytabs="${mytabs}\n<div id=\"tabs-${count}\">\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
940 mytabs="${mytabs}${tabcontent}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
941 mytabs="${mytabs}\n</div>\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
942 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
943 tabslist="${tabslist}</ul>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
944
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
945 ## Output the webpage
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
946 echo -e "<!doctype html>
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
947 <head>
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
948 <meta charset=\"utf-8\">
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
949 <title>iReport</title>
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
950 <link rel=\"stylesheet\" href=\"jquery-ui.css\">
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
951 <link rel=\"stylesheet\" href=\"ireport_css.css\">
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
952 <link rel=\"stylesheet\" href=\"md.css\">
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
953 <script type=\"text/javascript\" src=\"jquery-1.10.2.js\"></script>
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
954 <script type=\"text/javascript\" src=\"jquery-ui.js\"></script>
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
955 <script type=\"text/javascript\" src=\"iframe-resizer/src/iframeResizer.js\"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
956 <script type=\"text/javascript\" src=\"jquery.zoom.js\"></script>
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
957 <script type=\"text/javascript\" src=\"ireport_jquery.js\"></script>
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
958 <script type=\"text/javascript\" src=\"ireport_javascript.js\"></script>
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
959 </head>
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
960 <body>
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
961 <div id=\"tabs\" style=\"display:inline-block; min-height:100%; min-width:${minwidth}px\">
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
962 $tabslist
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
963
4
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
964 $mytabs
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
965 </div>
a4813532bbc6 Added MarkDown support
saskia-hiltemann
parents: 1
diff changeset
966 </body>
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
967 </html>" > $page
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents: 4
diff changeset
968 }