Mercurial > repos > brasset_jensen > srnapipe
comparison lib/sRNAPipe/html.pm @ 64:967512924317 draft
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
author | brasset_jensen |
---|---|
date | Mon, 28 Jan 2019 11:57:15 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
63:11708af40030 | 64:967512924317 |
---|---|
1 package sRNAPipe::html; | |
2 | |
3 use strict; | |
4 use warnings; | |
5 use File::Basename; | |
6 use File::Copy::Recursive qw( dircopy ); | |
7 | |
8 use Exporter; | |
9 our @ISA = qw( Exporter ); | |
10 our @EXPORT_OK = qw( &main_page &details_pages &menu_page &ppp_page ©_css ©_js ); | |
11 | |
12 sub main_page | |
13 { | |
14 my ( $dir, $file, $list_mainTabP, $current, $ma, $ma_uni, $dir_root ) = @_; | |
15 my ( $futHashP, $uniqueTabP, $randTabP, $pngTabP ) = get_genome ( $dir, $dir_root ); | |
16 | |
17 open my $h, '>', $file || die "cannot create $file $!\n"; | |
18 header ( $h ); | |
19 navbar ( $h, $list_mainTabP, $current ); | |
20 print $h "<div class=\"container\"><p><a class=\"btn\" href=\"$current-sub.html\">View details »</a></p></div>\n"; | |
21 futurette( $h, $current, $pngTabP, $futHashP ); | |
22 print $h "<div class=\"container\"><h2>mappers #: $ma</h2><h2>unique mappers #: $ma_uni</h2> </div>\n"; | |
23 carousel2( $h, $uniqueTabP, $randTabP, $dir_root ); | |
24 footer($h); | |
25 close $h; | |
26 } | |
27 | |
28 sub menu_page | |
29 { | |
30 my ( $dir, $file, $list_mainTabP, $current, $min, $max, $simin, $simax, $pimin, $pimax, $dir_root ) = @_; | |
31 my $html_ref = $1 if $dir =~ /$dir_root(.*)/; | |
32 open my $h, '>', $file || die "cannot create $file $!\n"; | |
33 header($h); | |
34 navbar ( $h, $list_mainTabP, $current ); | |
35 span( $h, $current, $min, $max, $simin, $simax, $pimin, $pimax ); | |
36 print $h " <div class=\"container\"> <div class=\"row text-center\"> <img src=\"$html_ref/pie_chart.png\"/><br />\n"; | |
37 print $h " <A HREF=\"$html_ref/repartition.txt\">text file</A><br/>\n </div></div>"; | |
38 footer($h); | |
39 close $h; | |
40 } | |
41 | |
42 sub details_pages | |
43 { | |
44 my ( $dir_details, $prefix, $list_mainTabP, $current, $misTE, $dir_root, $ppp ) = @_; | |
45 my ($Hex, $HTE, $HG, $NonUniTE, $NonUniG, $UniG ) = get_subgroups( $dir_details, $current, $misTE, $dir_root ); | |
46 | |
47 my $html_ref = $1.'-PPP.html' if $prefix =~ /$dir_root(.*)/; | |
48 open my $h, '>', $prefix.'-TEs.html' || die "cannot create $prefix-TEs.html $!\n"; | |
49 header($h); | |
50 navbar ( $h, $list_mainTabP, $current ); | |
51 if ( $prefix =~ /piRNAs$/ && $ppp eq 'true' ) | |
52 { | |
53 print $h " <div class=\"container\">"; | |
54 print $h " <p><a class=\"btn\" href=\"$html_ref\">Ping Pong Partners</a></p>\n"; | |
55 print $h "</div>"; | |
56 } | |
57 fut($h,'Transposable elements',$HTE); | |
58 carousel($h,$NonUniTE,$dir_root); | |
59 footer($h); | |
60 close $h; | |
61 | |
62 open $h, '>', $prefix.'-genome.html' || die "cannot create $prefix-genome.html $!\n"; | |
63 header($h); | |
64 navbar ( $h, $list_mainTabP, $current ); | |
65 fut($h,'Genome',$HG); | |
66 carousel2($h,$UniG, $NonUniG,$dir_root); | |
67 footer($h); | |
68 close $h; | |
69 | |
70 open $h, '>', $prefix.'-transcripts.html' || die "cannot create $prefix-transcripts.html $!\n"; | |
71 header($h); | |
72 navbar ( $h, $list_mainTabP, $current ); | |
73 fut($h,'transcripts',$Hex); | |
74 footer($h); | |
75 close $h; | |
76 } | |
77 | |
78 sub ppp_page | |
79 { | |
80 my ( $dir, $file, $list_mainTabP, $current, $ppp, $dir_root ) = @_; | |
81 | |
82 my $ppp_file = $ppp.'ppp.txt'; | |
83 open my $h, '>', $file || die "cannot create $file $!\n"; | |
84 header($h); | |
85 navbar ( $h, $list_mainTabP, $current ); | |
86 print $h '<div class="container"> <table class="wb-tables table table-striped table-hover">'."\n"; | |
87 print $h '<thead> | |
88 <tr> | |
89 <th data-sortable="true">ID</th> | |
90 <th data-sortable="true">overlap sum</th> | |
91 <th data-sortable="true">ten overlap sum</th> | |
92 <th data-sortable="true">mean</th> | |
93 <th data-sortable="true">standard deviation</th> | |
94 <th data-sortable="true">z-score</th> | |
95 <th data-sortable="true">p-value</th> | |
96 </tr> | |
97 </thead> | |
98 <tbody>'; | |
99 | |
100 open my $f, '<', $ppp_file || die "cannot open $ppp_file $!\n"; | |
101 while ( <$f> ) | |
102 { | |
103 chomp; | |
104 print $h '<tr>'; | |
105 my ( $id, $sum, $ten, $mean, $sd, $zscore, $prob) = split /\t/, $_; | |
106 if( -d "$ppp/$id" ) | |
107 { | |
108 my $sub_html = $ppp.$id.'.html'; | |
109 my $sub_html_ref = $1.$id if $ppp =~ /$dir_root(.*)/; | |
110 print $h "<td> <a href=\"$sub_html_ref.html\">$id</a> </td>"; | |
111 | |
112 open my $sub, '>', $sub_html || die "cannot create $sub_html\n"; | |
113 { | |
114 header($sub); | |
115 print $sub " | |
116 <div align=\"center\"> | |
117 <h2>$id</h2> | |
118 <p> <img class=\"featurette-image\" src=\"$id/histogram.png\"/></p> | |
119 <p><a href=\"$id/overlap_size.txt\">ping pong signature</a></p> | |
120 <p><a href=\"$id/sensPPP.txt\">sense reads with PPP</a></p> | |
121 <p><a href=\"$id/antisensPPP.txt\">reverse reads with PPP</a></p> | |
122 <p><a href=\"$id/sens.txt\">sense reads without PPP</a></p> | |
123 <p><a href=\"$id/antisens.txt\">reverse reads without PPP</a></p> | |
124 </div>"; | |
125 footer($sub); | |
126 } | |
127 close $sub; | |
128 } | |
129 else { print $h "<td> $id </td>\n"; } | |
130 print $h "<td> $sum </td><td> $ten </td><td> $mean </td><td> $sd </td><td> $zscore </td><td> $prob </td>\n"; | |
131 | |
132 print $h '</tr>'; | |
133 } | |
134 close $f; | |
135 print $h "</tbody></table></div>"; | |
136 footer($h); | |
137 close $h; | |
138 } | |
139 | |
140 sub get_genome | |
141 { | |
142 my ( $dir, $dir_root ) = @_; | |
143 my ( %hash, @group, @Unique, @NonUnique, @png ); | |
144 | |
145 my $fut = "'$dir'".'/*'; | |
146 my @fut = glob $fut; | |
147 | |
148 | |
149 foreach my $fr ( @fut ) | |
150 { | |
151 my $f = $1 if $fr =~ /$dir_root(.*)/; | |
152 if ( $fr =~ /.*Gviz/ ) | |
153 { | |
154 my $nu = "'$fr'".'/rand/*'; | |
155 @NonUnique = glob $nu; | |
156 my $u = "'$fr'".'/unique/*'; | |
157 @Unique = glob $u; | |
158 } | |
159 elsif ( $f =~ /.*distribution\.txt$/ ) { $hash{'mappers size distribution (txt)'} = $f; } | |
160 elsif ( $f =~ /.*distribution\.png$/ ) { push @png, $f; } | |
161 elsif ( $f =~ /.*unique\.fastq$/ ) { $hash{'unique mappers (fastq.gz)'} = $f.'.gz'; `gzip '$fr'`; } | |
162 elsif ( $f =~ /.*rejected\.fastq$/ ) { $hash{'unmapped (fastq.gz)'} = $f.'.gz'; `gzip '$fr'`; } | |
163 elsif ( $f =~ /.*all\.fastq$/ ) { $hash{'mappers (fastq.gz)'} = $f.'.gz'; `gzip '$fr'`; } | |
164 elsif ( $f =~ /.*dup_unique\.txt$/ ) { $hash{'unique mappers (txt)'} = $f; } | |
165 elsif ( $f =~ /.*dup_mapnum\.txt$/ ) { $hash{'mappers (txt)'} = $f; } | |
166 elsif ( $f =~ /.*dup_nonmapp\.txt$/ ) { $hash{'unmapped (txt)'} = $f; } | |
167 elsif ( $f =~ /.*_unique_sorted\.bam$/ ) { $hash{'unique alignment (bam)'} = $f; } | |
168 elsif ( $f =~ /.*_sorted\.bam$/ ) { $hash{'alignment (bam)'} = $f; } | |
169 elsif ( $f =~ /.*unique_plus.bedgraph/) { $hash{'bedgraph unique plus strand'} = $f; } | |
170 elsif ( $f =~ /.*unique_minus.bedgraph/) { $hash{'bedgraph unique minus strand'} = $f; } | |
171 elsif ( $f =~ /.*plus.bedgraph/) { $hash{'bedgraph plus strand'} = $f; } | |
172 elsif ( $f =~ /.*minus.bedgraph/) { $hash{'bedgraph minus strand'} = $f; } | |
173 else { unlink $fr; } | |
174 } | |
175 return (\%hash, \@Unique, \@NonUnique, \@png); | |
176 } | |
177 | |
178 sub span | |
179 { | |
180 my ( $file, $name, $min, $max, $simin, $simax, $pimin, $pimax ) = @_; | |
181 | |
182 print $file " | |
183 <div class=\"container text-center\"> | |
184 <div class=\"row-fluid\"> | |
185 <div class=\"span6\"> | |
186 <h2>Bonafide</h2> | |
187 reads of size between $min and $max<br>with no mi, sn, t and r RNAs | |
188 <p><a class=\"btn\" href=\"$name-bonafide_reads-genome.html\">Genome</a></p> | |
189 <p><a class=\"btn\" href=\"$name-bonafide_reads-TEs.html\">TE</a></p> | |
190 <p><a class=\"btn\" href=\"$name-bonafide_reads-transcripts.html\">Transcripts</a></p> | |
191 <div class=\"row-fluid\"> | |
192 <div class=\"span6\"> | |
193 <h2>siRNAs</h2> | |
194 bonafide reads of size between $simin and $simax | |
195 <p><a class=\"btn\" href=\"$name-siRNAs-genome.html\">Genome</a></p> | |
196 <p><a class=\"btn\" href=\"$name-siRNAs-TEs.html\">TE</a></p> | |
197 <p><a class=\"btn\" href=\"$name-siRNAs-transcripts.html\">Transcripts</a></p> | |
198 </div> | |
199 <div class=\"span6\"> | |
200 <h2>piRNAs</h2> | |
201 bonafide reads of size between $pimin and $pimax | |
202 <p><a class=\"btn\" href=\"$name-piRNAs-genome.html\">Genome</a></p> | |
203 <p><a class=\"btn\" href=\"$name-piRNAs-TEs.html\">TE</a></p> | |
204 <p><a class=\"btn\" href=\"$name-piRNAs-transcripts.html\">Transcripts</a></p> | |
205 </div> | |
206 </div> | |
207 </div> | |
208 <div class=\"span6\"> | |
209 <h2>miRNAs</h2> | |
210 <p><a class=\"btn\" href=\"$name-miRNAs-genome.html\">Genome</a></p> | |
211 <p><a class=\"btn\" href=\"$name-miRNAs-TEs.html\">TE</a></p> | |
212 <p><a class=\"btn\" href=\"$name-miRNAs-transcripts.html\">Transcripts</a></p> | |
213 </div> | |
214 </div> | |
215 </div> | |
216 "; | |
217 } | |
218 | |
219 sub get_subgroups | |
220 { | |
221 my ( $dir, $name, $misTE, $dir_root ) = @_; | |
222 my (%Hex, %HTE, %HG, @group, @png, @pngTE, @NonUniTE, @UniG, @NonUniG ); | |
223 | |
224 my $fut = "'$dir'".'/*'; | |
225 my @fut = glob $fut; | |
226 my $f =''; | |
227 foreach my $fr ( @fut ) | |
228 { | |
229 $f = $1 if $fr =~ /$dir_root(.*)/; | |
230 | |
231 if ( $f =~ /genome_unique_sorted\.bam$/ ) { $HG{'genome unique mappers (sorted bam)'} = $f; } | |
232 elsif ( $f =~ /genome_sorted\.bam$/ ) { $HG{'genome mappers (sorted bam)'} = $f; } | |
233 elsif ( $f =~ /miRNAs_reads_counts\.txt$/ ) { $HG{'miRNAs per type (txt)'} = $f; } | |
234 elsif ( $f =~ /genome_unique_plus\.bedgraph$/) { $HG{'bedgraph unique plus strand'} = $f; } | |
235 elsif ( $f =~ /genome_unique_minus\.bedgraph$/) { $HG{'bedgraph unique minus strand'} = $f; } | |
236 elsif ( $f =~ /genome_plus\.bedgraph$/) { $HG{'bedgraph plus strand'} = $f; } | |
237 elsif ( $f =~ /genome_minus\.bedgraph$/) { $HG{'bedgraph minus strand'} = $f; } | |
238 elsif ( $f =~ /TEs_plus\.bedgraph$/) { $HTE{'bedgraph plus strand'} = $f; } | |
239 elsif ( $f =~ /TEs_minus\.bedgraph$/) { $HTE{'bedgraph minus strand'} = $f; } | |
240 elsif ( $f =~ /transcripts_sorted\.bam$/) { $Hex{'transcripts mappers (sorted bam)'} = $f;} | |
241 elsif ( $f =~ /transcripts_unique_sorted\.bam$/) { $Hex{'transcripts unique mappers (sorted bam)'} = $f;} | |
242 elsif ( $f =~ /transcripts_reads_counts\.txt$/) { $Hex{'read number per transcript (txt)'} = $f;} | |
243 elsif ( $f =~ /TEs_reads_counts\.txt$/) { $HTE{"read number per TE 0 to $misTE mismatches (txt)"} = $f; } | |
244 elsif ( $f =~ /TEs_reads_counts_mismatches\.txt$/) { $HTE{"read number per TE with 1 to $misTE mismatches (txt)"} = $f; } | |
245 elsif ( $f =~ /TEs_reads_counts_nomismatches\.txt$/) { $HTE{'read number per TE with no mismatch (txt)'} = $f; } | |
246 elsif ( $f =~ /TEs_unique_sorted\.bam$/) { $HTE{'TEs unique mappers (sorted bam)'} = $f; } | |
247 elsif ( $f =~ /TEs_sorted\.bam$/) { $HTE{'TEs mappers (sorted bam)'} = $f; } | |
248 elsif ( $fr =~ /.*Gviz_TEs/ ) | |
249 { | |
250 my $nu = "'$fr'".'/*'; | |
251 @NonUniTE = glob $nu; | |
252 } | |
253 elsif ( $fr =~ /.*Gviz_genome/ ) | |
254 { | |
255 my $nu = "'$fr'".'/rand/*'; | |
256 @NonUniG = glob $nu; | |
257 my $u = "'$fr'".'/unique/*'; | |
258 @UniG = glob $u; | |
259 } | |
260 else { unlink $fr; } | |
261 } | |
262 return (\%Hex, \%HTE, \%HG, \@NonUniTE, \@NonUniG, \@UniG); | |
263 } | |
264 | |
265 sub header | |
266 { | |
267 my $file = shift; | |
268 print $file " | |
269 <!DOCTYPE html> | |
270 <html lang=\"en\"> | |
271 <head> | |
272 <meta charset=\"utf-8\"> | |
273 <title>pipeline</title> | |
274 <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> | |
275 <meta name=\"description\" content=\"\"> | |
276 <meta name=\"author\" content=\"\"> | |
277 <!-- Le styles --> | |
278 <link href=\"css/bootstrap.css\" rel=\"stylesheet\"> | |
279 <link href=\"css/bootstrap-table.css\" rel=\"stylesheet\"> | |
280 <style type=\"text/css\"> | |
281 body { | |
282 padding-top: 60px; | |
283 padding-bottom: 40px; | |
284 } | |
285 div#page { | |
286 width: 940px; | |
287 background-color: #fff; | |
288 margin: 0 auto; | |
289 text-align: left; | |
290 border-color: #fff; | |
291 border-style: none solid solid; | |
292 border-width: medium 1px 1px; | |
293 } | |
294 | |
295 div.content { | |
296 display: none; | |
297 float: right; | |
298 width: 550px; | |
299 } | |
300 div.content a, div.navigation a { | |
301 text-decoration: none; | |
302 color: #777; | |
303 } | |
304 div.content a:focus, div.content a:hover, div.content a:active { | |
305 text-decoration: underline; | |
306 } | |
307 | |
308 div.controls { | |
309 margin-top: 5px; | |
310 height: 23px; | |
311 } | |
312 | |
313 div.controls a { | |
314 padding: 5px; | |
315 } | |
316 div.ss-controls { | |
317 float: left; | |
318 } | |
319 div.nav-controls { | |
320 float: right; | |
321 } | |
322 div.slideshow-container { | |
323 position: relative; | |
324 clear: both; | |
325 height: 502px; /* This should be set to be at least the height of the largest image in the slideshow */ | |
326 } | |
327 div.loader { | |
328 position: absolute; | |
329 top: 0; | |
330 left: 0; | |
331 background-image: url('loader.gif'); | |
332 background-repeat: no-repeat; | |
333 background-position: center; | |
334 width: 550px; | |
335 height: 502px; /* This should be set to be at least the height of the largest image in the slideshow */ | |
336 } | |
337 div.slideshow { | |
338 | |
339 } | |
340 | |
341 div.slideshow span.image-wrapper { | |
342 display: block; | |
343 position: absolute; | |
344 top: 0; | |
345 left: 0; | |
346 } | |
347 div.slideshow a.advance-link { | |
348 display: block; | |
349 width: 550px; | |
350 height: 502px; /* This should be set to be at least the height of the largest image in the slideshow */ | |
351 line-height: 502px; /* This should be set to be at least the height of the largest image in the slideshow */ | |
352 text-align: center; | |
353 } | |
354 div.slideshow a.advance-link:hover, div.slideshow a.advance-link:active, div.slideshow a.advance-link:visited { | |
355 text-decoration: none; | |
356 } | |
357 div.slideshow img { | |
358 vertical-align: middle; | |
359 border: 1px solid #ccc; | |
360 } | |
361 | |
362 div.image-title { | |
363 font-weight: bold; | |
364 font-size: 1.4em; | |
365 } | |
366 | |
367 div.image-desc { | |
368 line-height: 1.3em; | |
369 padding-top: 12px; | |
370 } | |
371 div.navigation { | |
372 | |
373 } | |
374 ul.thumbs { | |
375 clear: both; | |
376 margin: 0; | |
377 padding: 0; | |
378 } | |
379 ul.thumbs li { | |
380 float: none; | |
381 padding: 0; | |
382 margin: 0; | |
383 list-style: none; | |
384 } | |
385 a.thumb { | |
386 padding: 0; | |
387 display: inline; | |
388 border: none; | |
389 } | |
390 ul.thumbs li.selected a.thumb { | |
391 color: #000; | |
392 font-weight: bold; | |
393 } | |
394 a.thumb:focus { | |
395 outline: none; | |
396 } | |
397 ul.thumbs img { | |
398 border: none; | |
399 display: block; | |
400 } | |
401 div.pagination { | |
402 clear: both; | |
403 } | |
404 div.navigation div.top { | |
405 margin-bottom: 12px; | |
406 height: 11px; | |
407 } | |
408 div.navigation div.bottom { | |
409 margin-top: 12px; | |
410 } | |
411 div.pagination a, div.pagination span.current, div.pagination span.ellipsis { | |
412 display: block; | |
413 float: left; | |
414 margin-right: 2px; | |
415 padding: 4px 7px 2px 7px; | |
416 border: 1px solid #ccc; | |
417 } | |
418 div.pagination a:hover { | |
419 background-color: #eee; | |
420 text-decoration: none; | |
421 } | |
422 div.pagination span.current { | |
423 font-weight: bold; | |
424 background-color: #000; | |
425 border-color: #000; | |
426 color: #fff; | |
427 } | |
428 div.pagination span.ellipsis { | |
429 border: none; | |
430 padding: 5px 0 3px 2px; | |
431 } | |
432 | |
433 div.download { | |
434 float: right; | |
435 } | |
436 | |
437 div.caption-container { | |
438 position: relative; | |
439 clear: left; | |
440 height: 75px; | |
441 } | |
442 span.image-caption { | |
443 display: block; | |
444 position: absolute; | |
445 width: 550px; | |
446 top: 0; | |
447 left: 0; | |
448 } | |
449 div.caption { | |
450 padding: 12px; | |
451 } | |
452 | |
453 /* Featurettes | |
454 ------------------------- */ | |
455 | |
456 .featurette { | |
457 padding-top: 20px; /* Vertically center images part 1: add padding above and below text. */ | |
458 overflow: hidden; /* Vertically center images part 2: clear their floats. */ | |
459 text-align: center; | |
460 } | |
461 | |
462 .featurette-p | |
463 { | |
464 text-align: left; | |
465 } | |
466 | |
467 .featurette-image { | |
468 margin-top: 10px; /* Vertically center images part 3: negative margin up the image the same amount of the padding to center it. */ | |
469 width: 450px; | |
470 height: auto; | |
471 } | |
472 | |
473 </style> | |
474 <link href=\"css/bootstrap-responsive.css\" rel=\"stylesheet\"> | |
475 </head> | |
476 <body> | |
477 "; | |
478 } | |
479 | |
480 sub navbar | |
481 { | |
482 my ( $file, $fastq, $actif ) = @_; | |
483 | |
484 print $file " | |
485 <div class=\"navbar navbar-inverse navbar-fixed-top\"> | |
486 <div class=\"navbar-inner\"> | |
487 <div class=\"container\"> | |
488 <button type=\"button\" class=\"btn btn-navbar\" data-toggle=\"collapse\" data-target=\".nav-collapse\"> | |
489 <span class=\"icon-bar\"></span> | |
490 <span class=\"icon-bar\"></span> | |
491 <span class=\"icon-bar\"></span> | |
492 </button> | |
493 <a class=\"brand\" href=\"report.txt\">Report</a> | |
494 <div class=\"nav-collapse collapse\"> | |
495 <ul class=\"nav\"> | |
496 "; | |
497 for (my $i = 0 ; $i <= $#{$fastq}; $i++) | |
498 { | |
499 # my $fa = basename($fastq->[$i],'.dat'); | |
500 my $fa = $fastq->[$i]; | |
501 if ($actif eq $fa){ print $file "<li class=\"active\"><a href=\"$fastq->[$i].html\">$fa</a></li>";} | |
502 else {print $file "<li><a href=\"$fastq->[$i].html\">$fa</a></li>" ;} | |
503 } | |
504 print $file " | |
505 </ul> | |
506 </div><!--/.nav-collapse --> | |
507 </div> | |
508 </div> | |
509 </div>"; | |
510 } | |
511 | |
512 sub footer | |
513 { | |
514 my $file = shift; | |
515 print $file " | |
516 <!-- FOOTER --> | |
517 <div class=\"container\"> | |
518 <footer> | |
519 | |
520 </footer> | |
521 </div> | |
522 <!-- Le javascript | |
523 ================================================== --> | |
524 <!-- Placed at the end of the document so the pages load faster --> | |
525 <script type=\"text/javascript\" src=\"js/filter.js\"></script> | |
526 <script type=\"text/javascript\" src=\"js/jquery.js\"></script> | |
527 <script type=\"text/javascript\" src=\"js/jquery-1.3.2.js\"></script> | |
528 <script type=\"text/javascript\" src=\"js/jquery.galleriffic.js\"></script> | |
529 <script type=\"text/javascript\" src=\"js/jquery.opacityrollover.js\"></script> | |
530 <script type=\"text/javascript\" src=\"js/bootstrap-table.js\"></script> | |
531 <script type=\"text/javascript\" src=\"js/bootstrap.min.js\"></script> | |
532 <script type=\"text/javascript\"> | |
533 jQuery(document).ready(function(\$) { | |
534 // We only want these styles applied when javascript is enabled | |
535 \$('div.navigation').css({'width' : '300px', 'float' : 'left'}); | |
536 \$('div.content').css('display', 'block'); | |
537 | |
538 \$(\".each-gallery\").each(function(i){ | |
539 // Initially set opacity on thumbs and add | |
540 // additional styling for hover effect on thumbs | |
541 var onMouseOutOpacity = 0.67; | |
542 \$('#thumbs + i + ul.thumbs li').opacityrollover({ | |
543 mouseOutOpacity: onMouseOutOpacity, | |
544 mouseOverOpacity: 1.0, | |
545 fadeSpeed: 'fast', | |
546 exemptionSelector: '.selected' | |
547 }); | |
548 | |
549 // Initialize Advanced Galleriffic Gallery | |
550 var gallery = \$('#thumbs'+i).galleriffic({ | |
551 delay: 2500, | |
552 numThumbs: 22, | |
553 preloadAhead: 10, | |
554 enableTopPager: true, | |
555 enableBottomPager: true, | |
556 maxPagesToShow: 7, | |
557 imageContainerSel: '#slideshow'+ i, | |
558 controlsContainerSel: '#controls' + i, | |
559 captionContainerSel: '#caption' + i, | |
560 loadingContainerSel: '#loading' + i, | |
561 renderSSControls: true, | |
562 renderNavControls: true, | |
563 playLinkText: 'Play', | |
564 pauseLinkText: 'Pause', | |
565 prevLinkText: '‹ Previous', | |
566 nextLinkText: 'Next ›', | |
567 nextPageLinkText: 'Next ›', | |
568 prevPageLinkText: '‹ Prev', | |
569 enableHistory: false, | |
570 autoStart: false, | |
571 syncTransitions: true, | |
572 defaultTransitionDuration: 900, | |
573 onSlideChange: function(prevIndex, nextIndex) { | |
574 // 'this' refers to the gallery, which is an extension of \$('#thumbs') | |
575 this.find('ul.thumbs').children() | |
576 .eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end() | |
577 .eq(nextIndex).fadeTo('fast', 1.0); | |
578 }, | |
579 onPageTransitionOut: function(callback) { | |
580 this.fadeTo('fast', 0.0, callback); | |
581 }, | |
582 onPageTransitionIn: function() { | |
583 this.fadeTo('fast', 1.0); | |
584 } | |
585 }); | |
586 }); | |
587 }); | |
588 </script> | |
589 </body> | |
590 </html> | |
591 "; | |
592 } | |
593 | |
594 sub carousel | |
595 { | |
596 my ($file, $non_unique, $dir_root) = @_; | |
597 my $ac = 0; | |
598 print $file " | |
599 <div id=\"page\"> | |
600 <div id=\"container\"> | |
601 <div class=\"each-gallery\"> | |
602 <div id=\"gallery\" class=\"content\"> | |
603 <div id=\"controls0\" class=\"controls\"></div> | |
604 <div class=\"slideshow-container\"> | |
605 <div id=\"loading0\" class=\"loader\"></div> | |
606 <div id=\"slideshow0\" class=\"slideshow\"></div> | |
607 </div> | |
608 <div id=\"caption0\" class=\"caption-container\">Reads randomly assigned</div> | |
609 </div> | |
610 <div id=\"thumbs0\" class=\"navigation\"> | |
611 <input type=\"text\" id=\"myInput0\" onkeyup=\"search(this)\" placeholder=\"Search for names...\"> | |
612 <ul class=\"thumbs noscript\"> | |
613 "; | |
614 foreach my $u (@{$non_unique}) | |
615 { | |
616 my $name = basename($u,'.png'); | |
617 $u = $1 if $u =~ /$dir_root(.*)/; | |
618 print $file " | |
619 <li> | |
620 <a class=\"thumb\" href=\"$u\" title=\"$name\">$name</a> | |
621 </li> | |
622 "; | |
623 } | |
624 print $file " | |
625 </ul> | |
626 </div> | |
627 <div style=\"clear: both;\"></div></div> | |
628 </div> | |
629 </div> | |
630 "; | |
631 } | |
632 | |
633 sub carousel2 | |
634 { | |
635 my ($file, $unique, $non_unique, $dir_root) = @_; | |
636 print $file " | |
637 <div id=\"page\"> | |
638 <div id=\"container\"> | |
639 <div class=\"each-gallery\"> | |
640 <div id=\"gallery\" class=\"content\"> | |
641 <div id=\"controls0\" class=\"controls\"></div> | |
642 <div class=\"slideshow-container\"> | |
643 <div id=\"loading0\" class=\"loader\"></div> | |
644 <div id=\"slideshow0\" class=\"slideshow\"></div> | |
645 </div> | |
646 <div id=\"caption0\" class=\"caption-container\">Uniquely mapped reads</div> | |
647 </div> | |
648 <div id=\"thumbs0\" class=\"navigation\"> | |
649 <input type=\"text\" id=\"myInput0\" onkeyup=\"search(this)\" placeholder=\"Search for names...\"> | |
650 <ul class=\"thumbs noscript\"> | |
651 "; | |
652 | |
653 foreach my $u (@{$unique}) | |
654 { | |
655 my $name = basename($u,'.png'); | |
656 $u = $1 if $u =~ /$dir_root(.*)/; | |
657 print $file " | |
658 <li> | |
659 <a class=\"thumb\" href=\"$u\" title=\"$name\">$name</a> | |
660 </li> | |
661 "; | |
662 } | |
663 print $file " | |
664 </ul> | |
665 </div> | |
666 </div> | |
667 <div id=\"page\"> | |
668 <div id=\"container\"> | |
669 <div class=\"each-gallery\"> | |
670 <div id=\"gallery\" class=\"content\"> | |
671 <div id=\"controls1\" class=\"controls\"></div> | |
672 <div class=\"slideshow-container\"> | |
673 <div id=\"loading1\" class=\"loader\"></div> | |
674 <div id=\"slideshow1\" class=\"slideshow\"></div> | |
675 </div> | |
676 <div id=\"caption1\" class=\"caption-container\">Reads randomly assigned</div> | |
677 </div> | |
678 <div id=\"thumbs1\" class=\"navigation\"> | |
679 <input type=\"text\" id=\"myInput1\" onkeyup=\"search(this)\" placeholder=\"Search for names...\"> | |
680 <ul class=\"thumbs noscript\"> | |
681 "; | |
682 | |
683 foreach my $nu (@{$non_unique}) | |
684 { | |
685 my $name = basename($nu,'.png'); | |
686 $nu = $1 if $nu =~ /$dir_root(.*)/; | |
687 print $file " | |
688 <li> | |
689 <a class=\"thumb\" href=\"$nu\" title=\"$name\">$name</a> | |
690 </li> | |
691 "; | |
692 } | |
693 print $file " | |
694 </ul> | |
695 </div> | |
696 <div style=\"clear: both;\"></div></div> | |
697 </div> | |
698 </div> | |
699 "; | |
700 } | |
701 | |
702 sub futurette | |
703 { | |
704 my ($file, $name, $png, $hash) = @_; | |
705 print $file " | |
706 <div class=\"container\"> | |
707 <div class=\"featurette\"> | |
708 <h1>$name</h1> | |
709 <p class=\"featurette-p\"> | |
710 "; | |
711 foreach my $k (sort keys %{$hash}) | |
712 { | |
713 print $file "<A HREF=\"".${$hash}{$k}."\">$k</A><br/> \n" ; | |
714 } | |
715 | |
716 print $file " | |
717 </p>"; | |
718 | |
719 foreach my $pn (@{$png}){print $file "<img class=\"featurette-image\" src=\"$pn\"/><br />";} | |
720 | |
721 print $file " | |
722 </div> | |
723 </div> | |
724 "; | |
725 } | |
726 | |
727 sub fut | |
728 { | |
729 my ($file, $name, $hash) = @_; | |
730 print $file " | |
731 <div class=\"container\"> | |
732 <div class=\"featurette\"> | |
733 <h1>$name</h1> | |
734 <p class=\"featurette-p\"> | |
735 "; | |
736 | |
737 foreach my $k (sort { ${$hash}{$a} cmp ${$hash}{$b} } keys %{$hash}) | |
738 { | |
739 print $file "<A HREF=\"".${$hash}{$k}."\">$k</A><br/> \n" ; | |
740 } | |
741 | |
742 print $file " | |
743 </p> | |
744 </div> | |
745 </div> | |
746 "; | |
747 } | |
748 | |
749 sub get_distri_exon | |
750 { | |
751 my ($dir, $name) = @_; | |
752 my (@out,@group); | |
753 my $group = "'$dir'".'/'."'$name'".'-subgroups-bonafide_reads-transcripts-*distribution-*.png'; | |
754 @group = glob $group; | |
755 foreach (my $g =0; $g <= $#group; $g++) | |
756 { | |
757 if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-transcripts-.*distribution-.*\.png)/ ) | |
758 { | |
759 my $tmp = $1; | |
760 push @out, $1; | |
761 } | |
762 } | |
763 return (\@out); | |
764 } | |
765 | |
766 sub get_distri_TE | |
767 { | |
768 my ($dir, $name) = @_; | |
769 my (@out,@group); | |
770 my $group = "'$dir'".'/'."'$name'".'-subgroups-bonafide_reads-TE-*distribution-*.png'; | |
771 @group = glob $group; | |
772 foreach (my $g =0; $g <= $#group; $g++) | |
773 { | |
774 if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-TE-.*distribution-.*\.png)/ ) | |
775 { | |
776 my $tmp = $1; | |
777 push @out, $1; | |
778 } | |
779 } | |
780 return (\@out); | |
781 } | |
782 | |
783 sub get_PPP | |
784 { | |
785 my ($dir,$name) = @_; | |
786 my (%distri,@group); | |
787 my $group = "'$dir'".'/'."'$name'".'-subgroups-bonafide_reads-TE-PPPartners-*'; | |
788 @group = glob $group; | |
789 | |
790 foreach (my $g =0; $g <= $#group; $g++) | |
791 { | |
792 if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-TE-PPPartners-.*)/ ) | |
793 { | |
794 my $tmp = $1; | |
795 if ($tmp =~ /PPPartners-(.*?)-sens\.txt$/) | |
796 { | |
797 $distri{$1} = ['','','','','',''] unless exists $distri{$1}; | |
798 $distri{$1}->[0] = $tmp; | |
799 } | |
800 elsif ($tmp =~ /PPPartners-(.*?)-antisens\.txt$/) | |
801 { | |
802 $distri{$1} = ['','','','','',''] unless exists $distri{$1}; | |
803 $distri{$1}->[1] = $tmp; | |
804 } | |
805 elsif ($tmp =~ /PPPartners-(.*?)-sensPPP\.txt$/) | |
806 { | |
807 $distri{$1} = ['','','','','',''] unless exists $distri{$1}; | |
808 $distri{$1}->[2] = $tmp; | |
809 } | |
810 elsif ($tmp =~ /PPPartners-(.*?)-antisensPPP\.txt$/) | |
811 { | |
812 $distri{$1} = ['','','','','',''] unless exists $distri{$1}; | |
813 $distri{$1}->[3] = $tmp; | |
814 } | |
815 elsif ($tmp =~ /PPPartners-(.*?)-overlap_size\.txt$/) | |
816 { | |
817 $distri{$1} = ['','','','','',''] unless exists $distri{$1}; | |
818 $distri{$1}->[4] = $tmp; | |
819 } | |
820 elsif ($tmp =~ /PPPartners-(.*?)-histogram\.png$/) | |
821 { | |
822 $distri{$1} = ['','','','','',''] unless exists $distri{$1}; | |
823 $distri{$1}->[5] = $tmp; | |
824 } | |
825 } | |
826 } | |
827 return \%distri; | |
828 } | |
829 | |
830 sub PPPrint | |
831 { | |
832 my ($h, $hash) = @_; | |
833 my $cmp = 0; | |
834 | |
835 print $h "<div class=\"container\">\n"; | |
836 print $h "<div class=\"row text-center\">"; | |
837 while ( my ($k,$v) = each %{$hash} ) | |
838 { | |
839 print $h "</div><div class=\"row text-center\">" if $cmp != 0 && $cmp % 2 == 0; | |
840 print $h " | |
841 | |
842 <div class=\"span6\"> | |
843 <h2>$k</h2> | |
844 <p class=\"featurette-p\"> <img src=\"$v->[5]\"/></p> | |
845 <p class=\"featurette-p\"><a href=\"$v->[4]\">ping pong signature</a></p> | |
846 <p class=\"featurette-p\"><a href=\"$v->[2]\">sense reads with PPP</a></p> | |
847 <p class=\"featurette-p\"><a href=\"$v->[3]\">reverse reads with PPP</a></p> | |
848 <p class=\"featurette-p\"><a href=\"$v->[0]\">sense reads without PPP</a></p> | |
849 <p class=\"featurette-p\"><a href=\"$v->[1]\">reverse reads without PPP</a></p> | |
850 </div> | |
851 "; | |
852 $cmp++; | |
853 } | |
854 | |
855 print $h "</div></div>"; | |
856 } | |
857 | |
858 sub printDistri | |
859 { | |
860 my ($h, $tab) = @_; | |
861 my ($txt, $name); | |
862 my $cmp = 0; | |
863 print $h "<div class=\"container\">\n"; | |
864 print $h "<div class=\"row text-center\">"; | |
865 foreach my $k (@{$tab}) | |
866 { | |
867 if ($k =~ /(.*)-(.*)\.png$/) | |
868 { | |
869 $txt = $1.'-'.$2.'.txt'; | |
870 $name = $2; | |
871 } | |
872 print $h "</div><div class=\"row text-center\">" if $cmp != 0 && $cmp % 2 == 0; | |
873 print $h " | |
874 | |
875 <div class=\"span6\"> | |
876 <h2>$name</h2> | |
877 <p> <img src=\"$k\"/></p> | |
878 <p class=\"featurette-p\"><a href=\"$txt\">text file</a></p> | |
879 </div> | |
880 "; | |
881 $cmp++; | |
882 } | |
883 | |
884 print $h "</div></div>"; | |
885 } | |
886 | |
887 sub mapnum | |
888 { | |
889 my $dupmapnum = shift; | |
890 my $dupnum_genome = shift; | |
891 open (my $dupTE, $dupmapnum) || die "cannot open ".$dupmapnum."\n"; | |
892 my %dupnum_TE = (); | |
893 my $header = <$dupTE>; | |
894 while (<$dupTE>) | |
895 { | |
896 chomp $_; | |
897 my @dupline = split /\t/, $_; | |
898 $dupnum_TE{$dupline[0]} = $dupline[2]; | |
899 } | |
900 close $dupTE; | |
901 open (my $du_TE, '>'.$dupmapnum) || die "cannot open to write ".$dupmapnum."\n"; | |
902 print $du_TE "sequence\tduplicate\tgenome map num\tmap num\n"; | |
903 while (my ($k, $v) = each %dupnum_TE ) | |
904 { | |
905 my $hashRef = ${$dupnum_genome}{$k}; | |
906 print $du_TE "$k\t$hashRef->[0]\t$hashRef->[1]\t$v\n"; | |
907 } | |
908 close $du_TE; | |
909 } | |
910 | |
911 sub copy_css | |
912 { | |
913 my $dir = shift; | |
914 my $path = dirname(__FILE__); | |
915 dircopy( $path.'/css', $dir.'/css' ); | |
916 } | |
917 | |
918 | |
919 sub copy_js | |
920 { | |
921 my $dir = shift; | |
922 my $path = dirname(__FILE__); | |
923 dircopy( $path.'/js', $dir.'/js' ); | |
924 } | |
925 | |
926 1; |