comparison bin/html.pm @ 1:1df6aaac800e draft

Deleted selected files
author brasset_jensen
date Wed, 13 Dec 2017 10:40:50 -0500
parents
children 360ec0ae04c9
comparison
equal deleted inserted replaced
0:e4e71401c577 1:1df6aaac800e
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 &raquo;</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, $ppp ) = @_;
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 =~ /piRNAs$/ && $ppp eq 'true' )
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.'-transcripts.html' || die "cannot create $prefix-transcripts.html $!\n";
70 header($h);
71 navbar ( $h, $list_mainTabP, $current );
72 fut($h,'transcripts',$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 class=\"featurette-image\" src=\"$id/histogram.png\"/></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</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/jquery.js\"></script>
526 <script type=\"text/javascript\" src=\"js/jquery-1.3.2.js\"></script>
527 <script type=\"text/javascript\" src=\"js/jquery.galleriffic.js\"></script>
528 <script type=\"text/javascript\" src=\"js/jquery.opacityrollover.js\"></script>
529 <script type=\"text/javascript\" src=\"js/bootstrap-table.js\"></script>
530 <script type=\"text/javascript\" src=\"js/bootstrap.min.js\"></script>
531 <script type=\"text/javascript\">
532 jQuery(document).ready(function(\$) {
533 // We only want these styles applied when javascript is enabled
534 \$('div.navigation').css({'width' : '300px', 'float' : 'left'});
535 \$('div.content').css('display', 'block');
536
537 \$(\".each-gallery\").each(function(i){
538 // Initially set opacity on thumbs and add
539 // additional styling for hover effect on thumbs
540 var onMouseOutOpacity = 0.67;
541 \$('#thumbs + i + ul.thumbs li').opacityrollover({
542 mouseOutOpacity: onMouseOutOpacity,
543 mouseOverOpacity: 1.0,
544 fadeSpeed: 'fast',
545 exemptionSelector: '.selected'
546 });
547
548 // Initialize Advanced Galleriffic Gallery
549 var gallery = \$('#thumbs'+i).galleriffic({
550 delay: 2500,
551 numThumbs: 22,
552 preloadAhead: 10,
553 enableTopPager: true,
554 enableBottomPager: true,
555 maxPagesToShow: 7,
556 imageContainerSel: '#slideshow'+ i,
557 controlsContainerSel: '#controls' + i,
558 captionContainerSel: '#caption' + i,
559 loadingContainerSel: '#loading' + i,
560 renderSSControls: true,
561 renderNavControls: true,
562 playLinkText: 'Play',
563 pauseLinkText: 'Pause',
564 prevLinkText: '&lsaquo; Previous',
565 nextLinkText: 'Next &rsaquo;',
566 nextPageLinkText: 'Next &rsaquo;',
567 prevPageLinkText: '&lsaquo; Prev',
568 enableHistory: false,
569 autoStart: false,
570 syncTransitions: true,
571 defaultTransitionDuration: 900,
572 onSlideChange: function(prevIndex, nextIndex) {
573 // 'this' refers to the gallery, which is an extension of \$('#thumbs')
574 this.find('ul.thumbs').children()
575 .eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
576 .eq(nextIndex).fadeTo('fast', 1.0);
577 },
578 onPageTransitionOut: function(callback) {
579 this.fadeTo('fast', 0.0, callback);
580 },
581 onPageTransitionIn: function() {
582 this.fadeTo('fast', 1.0);
583 }
584 });
585 });
586 });
587 </script>
588 </body>
589 </html>
590 ";
591 }
592
593 sub carousel
594 {
595 my ($file, $non_unique, $dir_root) = @_;
596 my $ac = 0;
597 print $file "
598 <div id=\"page\">
599 <div id=\"container\">
600 <div class=\"each-gallery\">
601 <div id=\"gallery\" class=\"content\">
602 <div id=\"controls0\" class=\"controls\"></div>
603 <div class=\"slideshow-container\">
604 <div id=\"loading0\" class=\"loader\"></div>
605 <div id=\"slideshow0\" class=\"slideshow\"></div>
606 </div>
607 <div id=\"caption0\" class=\"caption-container\">Reads randomly assigned</div>
608 </div>
609 <div id=\"thumbs0\" class=\"navigation\">
610 <ul class=\"thumbs noscript\">
611 ";
612 foreach my $u (@{$non_unique})
613 {
614 my $name = basename($u,'.png');
615 $u = $1 if $u =~ /$dir_root(.*)/;
616 print $file "
617 <li>
618 <a class=\"thumb\" href=\"$u\" title=\"$name\">$name</a>
619 </li>
620 ";
621 }
622 print $file "
623 </ul>
624 </div>
625 <div style=\"clear: both;\"></div></div>
626 </div>
627 </div>
628 ";
629 }
630
631 sub carousel2
632 {
633 my ($file, $unique, $non_unique, $dir_root) = @_;
634 print $file "
635 <div id=\"page\">
636 <div id=\"container\">
637 <div class=\"each-gallery\">
638 <div id=\"gallery\" class=\"content\">
639 <div id=\"controls0\" class=\"controls\"></div>
640 <div class=\"slideshow-container\">
641 <div id=\"loading0\" class=\"loader\"></div>
642 <div id=\"slideshow0\" class=\"slideshow\"></div>
643 </div>
644 <div id=\"caption0\" class=\"caption-container\">Uniquely mapped reads</div>
645 </div>
646 <div id=\"thumbs0\" class=\"navigation\">
647 <ul class=\"thumbs noscript\">
648 ";
649
650 foreach my $u (@{$unique})
651 {
652 my $name = basename($u,'.png');
653 $u = $1 if $u =~ /$dir_root(.*)/;
654 print $file "
655 <li>
656 <a class=\"thumb\" href=\"$u\" title=\"$name\">$name</a>
657 </li>
658 ";
659 }
660 print $file "
661 </ul>
662 </div>
663 </div>
664 <div id=\"page\">
665 <div id=\"container\">
666 <div class=\"each-gallery\">
667 <div id=\"gallery\" class=\"content\">
668 <div id=\"controls1\" class=\"controls\"></div>
669 <div class=\"slideshow-container\">
670 <div id=\"loading1\" class=\"loader\"></div>
671 <div id=\"slideshow1\" class=\"slideshow\"></div>
672 </div>
673 <div id=\"caption1\" class=\"caption-container\">Reads randomly assigned</div>
674 </div>
675 <div id=\"thumbs1\" class=\"navigation\">
676 <ul class=\"thumbs noscript\">
677 ";
678
679 foreach my $nu (@{$non_unique})
680 {
681 my $name = basename($nu,'.png');
682 $nu = $1 if $nu =~ /$dir_root(.*)/;
683 print $file "
684 <li>
685 <a class=\"thumb\" href=\"$nu\" title=\"$name\">$name</a>
686 </li>
687 ";
688 }
689 print $file "
690 </ul>
691 </div>
692 <div style=\"clear: both;\"></div></div>
693 </div>
694 </div>
695 ";
696 }
697
698 sub futurette
699 {
700 my ($file, $name, $png, $hash) = @_;
701 print $file "
702 <div class=\"container\">
703 <div class=\"featurette\">
704 <h1>$name</h1>
705 <p class=\"featurette-p\">
706 ";
707 foreach my $k (sort keys %{$hash})
708 {
709 print $file "<A HREF=\"".${$hash}{$k}."\">$k</A><br/> \n" ;
710 }
711
712 print $file "
713 </p>";
714
715 foreach my $pn (@{$png}){print $file "<img class=\"featurette-image\" src=\"$pn\"/><br />";}
716
717 print $file "
718 </div>
719 </div>
720 ";
721 }
722
723 sub fut
724 {
725 my ($file, $name, $hash) = @_;
726 print $file "
727 <div class=\"container\">
728 <div class=\"featurette\">
729 <h1>$name</h1>
730 <p class=\"featurette-p\">
731 ";
732
733 foreach my $k (sort { ${$hash}{$a} cmp ${$hash}{$b} } keys %{$hash})
734 {
735 print $file "<A HREF=\"".${$hash}{$k}."\">$k</A><br/> \n" ;
736 }
737
738 print $file "
739 </p>
740 </div>
741 </div>
742 ";
743 }
744
745 sub get_distri_exon
746 {
747 my ($dir, $name) = @_;
748 my (@out,@group);
749 my $group = $dir.'/'.$name.'-subgroups-bonafide_reads-transcripts-*distribution-*.png';
750 @group = glob $group;
751 foreach (my $g =0; $g <= $#group; $g++)
752 {
753 if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-transcripts-.*distribution-.*\.png)/ )
754 {
755 my $tmp = $1;
756 push @out, $1;
757 }
758 }
759 return (\@out);
760 }
761
762 sub get_distri_TE
763 {
764 my ($dir, $name) = @_;
765 my (@out,@group);
766 my $group = $dir.'/'.$name.'-subgroups-bonafide_reads-TE-*distribution-*.png';
767 @group = glob $group;
768 foreach (my $g =0; $g <= $#group; $g++)
769 {
770 if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-TE-.*distribution-.*\.png)/ )
771 {
772 my $tmp = $1;
773 push @out, $1;
774 }
775 }
776 return (\@out);
777 }
778
779 sub get_PPP
780 {
781 my ($dir,$name) = @_;
782 my (%distri,@group);
783 my $group = $dir.'/'.$name.'-subgroups-bonafide_reads-TE-PPPartners-*';
784 @group = glob $group;
785
786 foreach (my $g =0; $g <= $#group; $g++)
787 {
788 if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-TE-PPPartners-.*)/ )
789 {
790 my $tmp = $1;
791 if ($tmp =~ /PPPartners-(.*?)-sens\.txt$/)
792 {
793 $distri{$1} = ['','','','','',''] unless exists $distri{$1};
794 $distri{$1}->[0] = $tmp;
795 }
796 elsif ($tmp =~ /PPPartners-(.*?)-antisens\.txt$/)
797 {
798 $distri{$1} = ['','','','','',''] unless exists $distri{$1};
799 $distri{$1}->[1] = $tmp;
800 }
801 elsif ($tmp =~ /PPPartners-(.*?)-sensPPP\.txt$/)
802 {
803 $distri{$1} = ['','','','','',''] unless exists $distri{$1};
804 $distri{$1}->[2] = $tmp;
805 }
806 elsif ($tmp =~ /PPPartners-(.*?)-antisensPPP\.txt$/)
807 {
808 $distri{$1} = ['','','','','',''] unless exists $distri{$1};
809 $distri{$1}->[3] = $tmp;
810 }
811 elsif ($tmp =~ /PPPartners-(.*?)-overlap_size\.txt$/)
812 {
813 $distri{$1} = ['','','','','',''] unless exists $distri{$1};
814 $distri{$1}->[4] = $tmp;
815 }
816 elsif ($tmp =~ /PPPartners-(.*?)-histogram\.png$/)
817 {
818 $distri{$1} = ['','','','','',''] unless exists $distri{$1};
819 $distri{$1}->[5] = $tmp;
820 }
821 }
822 }
823 return \%distri;
824 }
825
826 sub PPPrint
827 {
828 my ($h, $hash) = @_;
829 my $cmp = 0;
830
831 print $h "<div class=\"container\">\n";
832 print $h "<div class=\"row text-center\">";
833 while ( my ($k,$v) = each %{$hash} )
834 {
835 print $h "</div><div class=\"row text-center\">" if $cmp != 0 && $cmp % 2 == 0;
836 print $h "
837
838 <div class=\"span6\">
839 <h2>$k</h2>
840 <p class=\"featurette-p\"> <img src=\"$v->[5]\"/></p>
841 <p class=\"featurette-p\"><a href=\"$v->[4]\">ping pong signature</a></p>
842 <p class=\"featurette-p\"><a href=\"$v->[2]\">sens reads with PPP</a></p>
843 <p class=\"featurette-p\"><a href=\"$v->[3]\">reverse reads with PPP</a></p>
844 <p class=\"featurette-p\"><a href=\"$v->[0]\">sens reads without PPP</a></p>
845 <p class=\"featurette-p\"><a href=\"$v->[1]\">reverse reads without PPP</a></p>
846 </div>
847 ";
848 $cmp++;
849 }
850
851 print $h "</div></div>";
852 }
853
854 sub printDistri
855 {
856 my ($h, $tab) = @_;
857 my ($txt, $name);
858 my $cmp = 0;
859 print $h "<div class=\"container\">\n";
860 print $h "<div class=\"row text-center\">";
861 foreach my $k (@{$tab})
862 {
863 if ($k =~ /(.*)-(.*)\.png$/)
864 {
865 $txt = $1.'-'.$2.'.txt';
866 $name = $2;
867 }
868 print $h "</div><div class=\"row text-center\">" if $cmp != 0 && $cmp % 2 == 0;
869 print $h "
870
871 <div class=\"span6\">
872 <h2>$name</h2>
873 <p> <img src=\"$k\"/></p>
874 <p class=\"featurette-p\"><a href=\"$txt\">text file</a></p>
875 </div>
876 ";
877 $cmp++;
878 }
879
880 print $h "</div></div>";
881 }
882
883 sub mapnum
884 {
885 my $dupmapnum = shift;
886 my $dupnum_genome = shift;
887 open (my $dupTE, $dupmapnum) || die "cannot open ".$dupmapnum."\n";
888 my %dupnum_TE = ();
889 my $header = <$dupTE>;
890 while (<$dupTE>)
891 {
892 chomp $_;
893 my @dupline = split /\t/, $_;
894 $dupnum_TE{$dupline[0]} = $dupline[2];
895 }
896 close $dupTE;
897 open (my $du_TE, '>'.$dupmapnum) || die "cannot open to write ".$dupmapnum."\n";
898 print $du_TE "sequence\tduplicate\tgenome map num\tmap num\n";
899 while (my ($k, $v) = each %dupnum_TE )
900 {
901 my $hashRef = ${$dupnum_genome}{$k};
902 print $du_TE "$k\t$hashRef->[0]\t$hashRef->[1]\t$v\n";
903 }
904 close $du_TE;
905 }
906
907 1;