comparison mutspecStat_wrapper.sh @ 7:eda59b985b1c draft default tip

Uploaded
author iarc
date Mon, 13 Mar 2017 08:21:19 -0400
parents 46a10309dfe2
children
comparison
equal deleted inserted replaced
6:46a10309dfe2 7:eda59b985b1c
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ######################################### 3 #########################################
4 ### SPECIFY THE NUMBER OF CPU ### 4 ### SPECIFY THE NUMBER OF CPU ###
5 ######################################### 5 #########################################
6 cpu=1 6 cpu=8
7 7
8 8
9 9
10 10
11 11
64 ######################################### 64 #########################################
65 css=$output_dir/Mutational_Analysis/style.css 65 css=$output_dir/Mutational_Analysis/style.css
66 echo ".legend{position:relative}.legend .legend-hidden{display:none;position:absolute;background-color:#fff;border:3px solid #03F;padding:3px;color:#000;font-size:1em;border-radius:10px;margin-top:-40px}.legend:hover .legend-hidden{display:block}" > $css 66 echo ".legend{position:relative}.legend .legend-hidden{display:none;position:absolute;background-color:#fff;border:3px solid #03F;padding:3px;color:#000;font-size:1em;border-radius:10px;margin-top:-40px}.legend:hover .legend-hidden{display:block}" > $css
67 67
68 68
69 #########################################
70 ### Create an archive with all results #
71 #########################################
72 cd $output_dir
73 zip -r "$output_dir/Mutational_Analysis.zip" "Mutational_Analysis"
74
75
69 76
70 # HMTL page for the result of the tool 77 # HMTL page for the result of the tool
71 echo "<html>" >> $html 78 echo "<html>" >> $html
72 echo "<body>" >> $html 79 echo "<body>" >> $html
73 80
74 if [ -d $output_dir/Mutational_Analysis/Figures ]; then 81 if [ -d $output_dir/Mutational_Analysis/Figures ]; then
75 82
76 echo "<center> <h2>Mutational spectra report summary</h2> </center>" >> $html 83 echo "<center> <h2>Mutational spectra report summary</h2> </center>" >> $html
84
85 echo "<br/> Download the results" >> $html
86 echo "<br/><a href="Mutational_Analysis.zip">Mutational_Analysis.zip</a><br/>" >> $html
77 87
78 echo "<br/> Download the full report in Excel" >> $html 88 echo "<br/> Download the full report in Excel" >> $html
79 89
80 ## One report with all the samples. Specify the full path 90 ## One report with all the samples. Specify the full path
81 if [[ -e "$output_dir/Mutational_Analysis/Report_Mutation_Spectra.xls" ]] 91 if [[ -e "$output_dir/Mutational_Analysis/Report_Mutation_Spectra.xls" ]]
133 fi 143 fi
134 144
135 145
136 ## HMTL Link to the samples 146 ## HMTL Link to the samples
137 echo "<br/> Link to individual samples <br/>" >> $html 147 echo "<br/> Link to individual samples <br/>" >> $html
138 for file in $names 148
149
150 ## Consider only samples with at least one mutation
151 for file in `ls $output_dir/Mutational_Analysis/Figures/Impact_protein_sequence`
139 do 152 do
153
140 name=$(echo ${file}| cut -d"=" -f2) 154 name=$(echo ${file}| cut -d"=" -f2)
141 name=${name%.*} 155 name=${name%.*}
156
157 ## Pool Data is handle separately
158 if [ $name = "Pool_Data" ]; then
159 continue
160 fi
161
142 outfile="$output_dir/Mutational_Analysis/$name.html" 162 outfile="$output_dir/Mutational_Analysis/$name.html"
143 touch $outfile # Create an empty file named $outfile 163 touch $outfile # Create an empty file named $outfile
144 echo "<a href='Mutational_Analysis/$name.html'>$name</a><br/>" >> $html 164 echo "<a href='Mutational_Analysis/$name.html'>$name</a><br/>" >> $html
145 165
146 #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------# 166 #-----------------------------------------------------------------------------------------------------------------------------------------------------#
147 # INDIVIDUAL SAMPLES # 167 # INDIVIDUAL SAMPLES #
148 #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------# 168 #-----------------------------------------------------------------------------------------------------------------------------------------------------#
149 echo "<br/> <center> <h2>Mutational Spectra report for $name</h2> </center> <br/>" >> $outfile 169 echo "<br/> <center> <h2>Mutational Spectra report for $name</h2> </center> <br/>" >> $outfile
150 170
151 echo "<html>" >> $outfile 171 echo "<html>" >> $outfile
152 172
153 echo "<head>" >> $outfile 173 echo "<head>" >> $outfile
270 echo "<tr>" >> $outfile 290 echo "<tr>" >> $outfile
271 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-CA-Probability.png" ]]; then 291 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-CA-Probability.png" ]]; then
272 echo "<td>WARNING: No sequence for C>A </br> </td>" >> $outfile 292 echo "<td>WARNING: No sequence for C>A </br> </td>" >> $outfile
273 else 293 else
274 echo "<td><a href="Figures/WebLogo/$name/$name-CA.fa">$name-CA.fa</a><br/>" >> $outfile 294 echo "<td><a href="Figures/WebLogo/$name/$name-CA.fa">$name-CA.fa</a><br/>" >> $outfile
275 echo "<img src="Figures/WebLogo/$name/$name-CA-Probability.png"/><br/></td>" >> $outfile 295 echo "<img src="Figures/WebLogo/$name/$name-CA-Probability.png width="600" "/><br/></td>" >> $outfile
276 fi 296 fi
277 # C>G 297 # C>G
278 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-CG-Probability.png" ]]; then 298 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-CG-Probability.png" ]]; then
279 echo "<td> WARNING: No sequence for C>G </br> </td>" >> $outfile 299 echo "<td> WARNING: No sequence for C>G </br> </td>" >> $outfile
280 else 300 else
281 echo "<td><a href="Figures/WebLogo/$name/$name-CG.fa">$name-CG.fa</a><br/>" >> $outfile 301 echo "<td><a href="Figures/WebLogo/$name/$name-CG.fa">$name-CG.fa</a><br/>" >> $outfile
282 echo "<img src="Figures/WebLogo/$name/$name-CG-Probability.png"/><br/></td>" >> $outfile 302 echo "<img src="Figures/WebLogo/$name/$name-CG-Probability.png width="600" "/><br/></td>" >> $outfile
283 fi 303 fi
284 # C>T 304 # C>T
285 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-CT-Probability.png" ]]; then 305 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-CT-Probability.png" ]]; then
286 echo "<td> WARNING: No sequence for C>T </br> </td>" >> $outfile 306 echo "<td> WARNING: No sequence for C>T </br> </td>" >> $outfile
287 else 307 else
288 echo "<td><a href="Figures/WebLogo/$name/$name-CT.fa">$name-CT.fa</a><br/>" >> $outfile 308 echo "<td><a href="Figures/WebLogo/$name/$name-CT.fa">$name-CT.fa</a><br/>" >> $outfile
289 echo "<img src="Figures/WebLogo/$name/$name-CT-Probability.png"/><br/></td>" >> $outfile 309 echo "<img src="Figures/WebLogo/$name/$name-CT-Probability.png width="600" "/><br/></td>" >> $outfile
290 fi 310 fi
291 echo "</tr>" >> $outfile 311 echo "</tr>" >> $outfile
292 312
293 # T>A 313 # T>A
294 echo "<tr>" >> $outfile 314 echo "<tr>" >> $outfile
295 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-TA-Probability.png" ]]; then 315 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-TA-Probability.png" ]]; then
296 echo "<td>WARNING: No sequence for T>A </br> </td>" >> $outfile 316 echo "<td>WARNING: No sequence for T>A </br> </td>" >> $outfile
297 else 317 else
298 echo "<td><a href="Figures/WebLogo/$name/$name-TA.fa">$name-TA.fa</a><br/>" >> $outfile 318 echo "<td><a href="Figures/WebLogo/$name/$name-TA.fa">$name-TA.fa</a><br/>" >> $outfile
299 echo "<img src="Figures/WebLogo/$name/$name-TA-Probability.png"/><br/></td>" >> $outfile 319 echo "<img src="Figures/WebLogo/$name/$name-TA-Probability.png width="600" "/><br/></td>" >> $outfile
300 fi 320 fi
301 # T>C 321 # T>C
302 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-TC-Probability.png" ]]; then 322 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-TC-Probability.png" ]]; then
303 echo "<td>WARNING: No sequence for T>C </br> </td>" >> $outfile 323 echo "<td>WARNING: No sequence for T>C </br> </td>" >> $outfile
304 else 324 else
305 echo "<td><a href="Figures/WebLogo/$name/$name-TC.fa">$name-TC.fa</a><br/>" >> $outfile 325 echo "<td><a href="Figures/WebLogo/$name/$name-TC.fa">$name-TC.fa</a><br/>" >> $outfile
306 echo "<img src="Figures/WebLogo/$name/$name-TC-Probability.png"/><br/></td>" >> $outfile 326 echo "<img src="Figures/WebLogo/$name/$name-TC-Probability.png width="600" "/><br/></td>" >> $outfile
307 fi 327 fi
308 # T>G 328 # T>G
309 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-TG-Probability.png" ]]; then 329 if [[ ! -e "$output_dir/Mutational_Analysis/Figures/WebLogo/$name/$name-TG-Probability.png" ]]; then
310 echo "<td>WARNING: No sequence for T>G </br> </td>" >> $outfile 330 echo "<td>WARNING: No sequence for T>G </br> </td>" >> $outfile
311 else 331 else
312 echo "<td><a href="Figures/WebLogo/$name/$name-TG.fa">$name-TG.fa</a><br/>" >> $outfile 332 echo "<td><a href="Figures/WebLogo/$name/$name-TG.fa">$name-TG.fa</a><br/>" >> $outfile
313 echo "<img src="Figures/WebLogo/$name/$name-TG-Probability.png"/><br/></td>" >> $outfile 333 echo "<img src="Figures/WebLogo/$name/$name-TG-Probability.png width="600" "/><br/></td>" >> $outfile
314 fi 334 fi
315 echo "</tr>" >> $outfile 335 echo "</tr>" >> $outfile
316 336
317 echo "</table>" >> $outfile 337 echo "</table>" >> $outfile
318 338
319 echo "</body></html>" >> $outfile 339 echo "</body></html>" >> $outfile
320 340
321 done 341 done
322 342
323 #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------# 343 #-----------------------------------------------------------------------------------------------------------------------------------------------------#
324 # POOL DATA # 344 # POOL DATA #
325 #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------# 345 #-----------------------------------------------------------------------------------------------------------------------------------------------------#
326 ## HMTL Link to Pool_Data 346 ## HMTL Link to Pool_Data
327 if [[ $parameters =~ "--pooldata" ]]; then 347 if [[ $parameters =~ "--pooldata" ]]; then
328 outfilePoolData="$output_dir/Mutational_Analysis/Pool_Data.html" 348 outfilePoolData="$output_dir/Mutational_Analysis/Pool_Data.html"
329 touch $outfilePoolData # Create an empty file named $outfile 349 touch $outfilePoolData # Create an empty file named $outfile
330 echo "<a href='Mutational_Analysis/Pool_Data.html'>Pool_Data</a><br/>" >> $html 350 echo "<a href='Mutational_Analysis/Pool_Data.html'>Pool_Data</a><br/>" >> $html