+
+
+
+
+
Uniquely mapped reads
+
+
+
+ ";
+
+ foreach my $u (@{$unique})
+ {
+ my $name = basename($u,'.png');
+ $u = $1 if $u =~ /$dir_root(.*)/;
+ print $file "
+ -
+ $name
+
+ ";
+ }
+ print $file "
+
+
+
+
+
+
+
+
+
+
Reads randomly assigned
+
+
+
+ ";
+
+ foreach my $nu (@{$non_unique})
+ {
+ my $name = basename($nu,'.png');
+ $nu = $1 if $nu =~ /$dir_root(.*)/;
+ print $file "
+ -
+ $name
+
+ ";
+ }
+ print $file "
+
+
+
+
+
+ ";
+}
+
+sub futurette
+{
+ my ($file, $name, $png, $hash) = @_;
+ print $file "
+
+
+
$name
+
+ ";
+ foreach my $k (sort keys %{$hash})
+ {
+ print $file "$k
\n" ;
+ }
+
+ print $file "
+
";
+
+ foreach my $pn (@{$png}){print $file "
";}
+
+ print $file "
+
+
+ ";
+}
+
+sub fut
+{
+ my ($file, $name, $hash) = @_;
+ print $file "
+
+
+
$name
+
+ ";
+
+ foreach my $k (sort { ${$hash}{$a} cmp ${$hash}{$b} } keys %{$hash})
+ {
+ print $file "$k
\n" ;
+ }
+
+ print $file "
+
+
+
+ ";
+}
+
+sub get_distri_exon
+{
+ my ($dir, $name) = @_;
+ my (@out,@group);
+ my $group = $dir.'/'.$name.'-subgroups-bonafide_reads-exons-*distribution-*.png';
+ @group = glob $group;
+ foreach (my $g =0; $g <= $#group; $g++)
+ {
+ if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-exons-.*distribution-.*\.png)/ )
+ {
+ my $tmp = $1;
+ push @out, $1;
+ }
+ }
+ return (\@out);
+}
+
+sub get_distri_TE
+{
+ my ($dir, $name) = @_;
+ my (@out,@group);
+ my $group = $dir.'/'.$name.'-subgroups-bonafide_reads-TE-*distribution-*.png';
+ @group = glob $group;
+ foreach (my $g =0; $g <= $#group; $g++)
+ {
+ if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-TE-.*distribution-.*\.png)/ )
+ {
+ my $tmp = $1;
+ push @out, $1;
+ }
+ }
+ return (\@out);
+}
+
+sub get_PPP
+{
+ my ($dir,$name) = @_;
+ my (%distri,@group);
+ my $group = $dir.'/'.$name.'-subgroups-bonafide_reads-TE-PPPartners-*';
+ @group = glob $group;
+
+ foreach (my $g =0; $g <= $#group; $g++)
+ {
+ if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-TE-PPPartners-.*)/ )
+ {
+ my $tmp = $1;
+ if ($tmp =~ /PPPartners-(.*?)-sens\.txt$/)
+ {
+ $distri{$1} = ['','','','','',''] unless exists $distri{$1};
+ $distri{$1}->[0] = $tmp;
+ }
+ elsif ($tmp =~ /PPPartners-(.*?)-antisens\.txt$/)
+ {
+ $distri{$1} = ['','','','','',''] unless exists $distri{$1};
+ $distri{$1}->[1] = $tmp;
+ }
+ elsif ($tmp =~ /PPPartners-(.*?)-sensPPP\.txt$/)
+ {
+ $distri{$1} = ['','','','','',''] unless exists $distri{$1};
+ $distri{$1}->[2] = $tmp;
+ }
+ elsif ($tmp =~ /PPPartners-(.*?)-antisensPPP\.txt$/)
+ {
+ $distri{$1} = ['','','','','',''] unless exists $distri{$1};
+ $distri{$1}->[3] = $tmp;
+ }
+ elsif ($tmp =~ /PPPartners-(.*?)-overlap_size\.txt$/)
+ {
+ $distri{$1} = ['','','','','',''] unless exists $distri{$1};
+ $distri{$1}->[4] = $tmp;
+ }
+ elsif ($tmp =~ /PPPartners-(.*?)-histogram\.png$/)
+ {
+ $distri{$1} = ['','','','','',''] unless exists $distri{$1};
+ $distri{$1}->[5] = $tmp;
+ }
+ }
+ }
+ return \%distri;
+}
+
+sub PPPrint
+{
+ my ($h, $hash) = @_;
+ my $cmp = 0;
+
+ print $h "
\n";
+ print $h "
";
+ while ( my ($k,$v) = each %{$hash} )
+ {
+ print $h "
" if $cmp != 0 && $cmp % 2 == 0;
+ print $h "
+
+
+ ";
+ $cmp++;
+ }
+
+ print $h "
";
+}
+
+sub printDistri
+{
+ my ($h, $tab) = @_;
+ my ($txt, $name);
+ my $cmp = 0;
+ print $h "
\n";
+ print $h "
";
+ foreach my $k (@{$tab})
+ {
+ if ($k =~ /(.*)-(.*)\.png$/)
+ {
+ $txt = $1.'-'.$2.'.txt';
+ $name = $2;
+ }
+ print $h "
" if $cmp != 0 && $cmp % 2 == 0;
+ print $h "
+
+
+ ";
+ $cmp++;
+ }
+
+ print $h "
";
+}
+
+sub mapnum
+{
+ my $dupmapnum = shift;
+ my $dupnum_genome = shift;
+ open (my $dupTE, $dupmapnum) || die "cannot open ".$dupmapnum."\n";
+ my %dupnum_TE = ();
+ my $header = <$dupTE>;
+ while (<$dupTE>)
+ {
+ chomp $_;
+ my @dupline = split /\t/, $_;
+ $dupnum_TE{$dupline[0]} = $dupline[2];
+ }
+ close $dupTE;
+ open (my $du_TE, '>'.$dupmapnum) || die "cannot open to write ".$dupmapnum."\n";
+ print $du_TE "sequence\tduplicate\tgenome map num\tmap num\n";
+ while (my ($k, $v) = each %dupnum_TE )
+ {
+ my $hashRef = ${$dupnum_genome}{$k};
+ print $du_TE "$k\t$hashRef->[0]\t$hashRef->[1]\t$v\n";
+ }
+ close $du_TE;
+}
+
+1;