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