# HG changeset patch # User pierre.pouchin # Date 1536243690 14400 # Node ID 263819fdda14cf721f58bfb47f694165734eb5bb # Parent 221ea7307999273fe2892a8c156cf5c58fcc92ba Uploaded diff -r 221ea7307999 -r 263819fdda14 bin/html.pm --- a/bin/html.pm Thu Jul 12 08:56:18 2018 -0400 +++ b/bin/html.pm Thu Sep 06 10:21:30 2018 -0400 @@ -1,911 +1,911 @@ -package html; - -use strict; -use warnings; -use File::Basename; - -use Exporter; -our @ISA = qw( Exporter ); -our @EXPORT_OK = qw( &main_page &details_pages &menu_page &ppp_page ); - -sub main_page -{ - my ( $dir, $file, $list_mainTabP, $current, $ma, $ma_uni, $dir_root ) = @_; - my ( $futHashP, $uniqueTabP, $randTabP, $pngTabP ) = get_genome ( $dir, $dir_root ); - - open my $h, '>', $file || die "cannot create $file $!\n"; - header ( $h ); - navbar ( $h, $list_mainTabP, $current ); - print $h "

View details »

\n"; - futurette( $h, $current, $pngTabP, $futHashP ); - print $h "

mappers #: $ma

unique mappers #: $ma_uni

\n"; - carousel2( $h, $uniqueTabP, $randTabP, $dir_root ); - footer($h); - close $h; -} - -sub menu_page -{ - my ( $dir, $file, $list_mainTabP, $current, $min, $max, $simin, $simax, $pimin, $pimax, $dir_root ) = @_; - my $html_ref = $1 if $dir =~ /$dir_root(.*)/; - open my $h, '>', $file || die "cannot create $file $!\n"; - header($h); - navbar ( $h, $list_mainTabP, $current ); - span( $h, $current, $min, $max, $simin, $simax, $pimin, $pimax ); - print $h "

\n"; - print $h " text file
\n
"; - footer($h); - close $h; -} - -sub details_pages -{ - my ( $dir_details, $prefix, $list_mainTabP, $current, $misTE, $dir_root, $ppp ) = @_; - my ($Hex, $HTE, $HG, $NonUniTE, $NonUniG, $UniG ) = get_subgroups( $dir_details, $current, $misTE, $dir_root ); - - my $html_ref = $1.'-PPP.html' if $prefix =~ /$dir_root(.*)/; - open my $h, '>', $prefix.'-TEs.html' || die "cannot create $prefix-TEs.html $!\n"; - header($h); - navbar ( $h, $list_mainTabP, $current ); - if ( $prefix =~ /piRNAs$/ && $ppp eq 'true' ) - { - print $h "
"; - print $h "

Ping Pong Partners

\n"; - print $h "
"; - } - fut($h,'Transposable elements',$HTE); - carousel($h,$NonUniTE,$dir_root); - footer($h); - close $h; - - open $h, '>', $prefix.'-genome.html' || die "cannot create $prefix-genome.html $!\n"; - header($h); - navbar ( $h, $list_mainTabP, $current ); - fut($h,'Genome',$HG); - carousel2($h,$UniG, $NonUniG,$dir_root); - footer($h); - close $h; - - open $h, '>', $prefix.'-transcripts.html' || die "cannot create $prefix-transcripts.html $!\n"; - header($h); - navbar ( $h, $list_mainTabP, $current ); - fut($h,'transcripts',$Hex); - footer($h); - close $h; -} - -sub ppp_page -{ - my ( $dir, $file, $list_mainTabP, $current, $ppp, $dir_root ) = @_; - - my $ppp_file = $ppp.'ppp.txt'; - open my $h, '>', $file || die "cannot create $file $!\n"; - header($h); - navbar ( $h, $list_mainTabP, $current ); - print $h '
'."\n"; - print $h ' - - - - - - - - - - - '; - - open my $f, '<', $ppp_file || die "cannot open $ppp_file $!\n"; - while ( <$f> ) - { - chomp; - print $h ''; - my ( $id, $sum, $ten, $mean, $sd, $zscore, $prob) = split /\t/, $_; - if( -d "$ppp/$id" ) - { - my $sub_html = $ppp.$id.'.html'; - my $sub_html_ref = $1.$id if $ppp =~ /$dir_root(.*)/; - print $h ""; - - open my $sub, '>', $sub_html || die "cannot create $sub_html\n"; - { - header($sub); - print $sub " -
-

$id

-

-

ping pong signature

-

sense reads with PPP

-

reverse reads with PPP

-

sense reads without PPP

-

reverse reads without PPP

-
"; - footer($sub); - } - close $sub; - - } - else { print $h "\n"; } - print $h "\n"; - - print $h ''; - } - close $f; - print $h "
IDoverlap sumten overlap summeanstandard deviationz-scorep-value
$id $id $sum $ten $mean $sd $zscore $prob
"; - footer($h); - close $h; -} - -sub get_genome -{ - my ( $dir, $dir_root ) = @_; - my ( %hash, @group, @Unique, @NonUnique, @png ); - - my $fut = $dir.'/*'; - my @fut = glob $fut; - - - foreach my $fr ( @fut ) - { - my $f = $1 if $fr =~ /$dir_root(.*)/; - if ( $fr =~ /.*Gviz/ ) - { - my $nu = $fr.'/rand/*'; - @NonUnique = glob $nu; - my $u = $fr.'/unique/*'; - @Unique = glob $u; - } - elsif ( $f =~ /.*distribution\.txt$/ ) { $hash{'mappers size distribution (txt)'} = $f; } - elsif ( $f =~ /.*distribution\.png$/ ) { push @png, $f; } - elsif ( $f =~ /.*unique\.fastq$/ ) { $hash{'unique mappers (fastq.gz)'} = $f.'.gz'; `gzip $fr`; } - elsif ( $f =~ /.*rejected\.fastq$/ ) { $hash{'unmapped (fastq.gz)'} = $f.'.gz'; `gzip $fr`; } - elsif ( $f =~ /.*all\.fastq$/ ) { $hash{'mappers (fastq.gz)'} = $f.'.gz'; `gzip $fr`; } - elsif ( $f =~ /.*dup_unique\.txt$/ ) { $hash{'unique mappers (txt)'} = $f; } - elsif ( $f =~ /.*dup_mapnum\.txt$/ ) { $hash{'mappers (txt)'} = $f; } - elsif ( $f =~ /.*dup_nonmapp\.txt$/ ) { $hash{'unmapped (txt)'} = $f; } - elsif ( $f =~ /.*_unique_sorted\.bam$/ ) { $hash{'unique alignment (bam)'} = $f; } - elsif ( $f =~ /.*_sorted\.bam$/ ) { $hash{'alignment (bam)'} = $f; } - elsif ( $f =~ /.*unique_plus.bedgraph/) { $hash{'bedgraph unique plus strand'} = $f; } - elsif ( $f =~ /.*unique_minus.bedgraph/) { $hash{'bedgraph unique minus strand'} = $f; } - elsif ( $f =~ /.*plus.bedgraph/) { $hash{'bedgraph plus strand'} = $f; } - elsif ( $f =~ /.*minus.bedgraph/) { $hash{'bedgraph minus strand'} = $f; } - else { unlink $fr; } - } - return (\%hash, \@Unique, \@NonUnique, \@png); -} - -sub span -{ - my ( $file, $name, $min, $max, $simin, $simax, $pimin, $pimax ) = @_; - - print $file " -
-
-
-

Bonafide

- reads of size between $min and $max
with no mi, sn, t and r RNAs -

Genome

-

TE

-

Transcripts

-
-
-

siRNAs

- bonafide reads of size between $simin and $simax -

Genome

-

TE

-

Transcripts

-
-
-

piRNAs

- bonafide reads of size between $pimin and $pimax -

Genome

-

TE

-

Transcripts

-
-
-
-
-

miRNAs

-

Genome

-

TE

-

Transcripts

-
-
-
-"; -} - -sub get_subgroups -{ - my ( $dir, $name, $misTE, $dir_root ) = @_; - my (%Hex, %HTE, %HG, @group, @png, @pngTE, @NonUniTE, @UniG, @NonUniG ); - - my $fut = $dir.'/*'; - my @fut = glob $fut; - my $f =''; - foreach my $fr ( @fut ) - { - $f = $1 if $fr =~ /$dir_root(.*)/; - - if ( $f =~ /genome_unique_sorted\.bam$/ ) { $HG{'genome unique mappers (sorted bam)'} = $f; } - elsif ( $f =~ /genome_sorted\.bam$/ ) { $HG{'genome mappers (sorted bam)'} = $f; } - elsif ( $f =~ /miRNAs_reads_counts\.txt$/ ) { $HG{'miRNAs per type (txt)'} = $f; } - elsif ( $f =~ /genome_unique_plus\.bedgraph$/) { $HG{'bedgraph unique plus strand'} = $f; } - elsif ( $f =~ /genome_unique_minus\.bedgraph$/) { $HG{'bedgraph unique minus strand'} = $f; } - elsif ( $f =~ /genome_plus\.bedgraph$/) { $HG{'bedgraph plus strand'} = $f; } - elsif ( $f =~ /genome_minus\.bedgraph$/) { $HG{'bedgraph minus strand'} = $f; } - elsif ( $f =~ /TEs_plus\.bedgraph$/) { $HTE{'bedgraph plus strand'} = $f; } - elsif ( $f =~ /TEs_minus\.bedgraph$/) { $HTE{'bedgraph minus strand'} = $f; } - elsif ( $f =~ /transcripts_sorted\.bam$/) { $Hex{'transcripts mappers (sorted bam)'} = $f;} - elsif ( $f =~ /transcripts_unique_sorted\.bam$/) { $Hex{'transcripts unique mappers (sorted bam)'} = $f;} - elsif ( $f =~ /transcripts_reads_counts\.txt$/) { $Hex{'read number per transcript (txt)'} = $f;} - elsif ( $f =~ /TEs_reads_counts\.txt$/) { $HTE{"read number per TE 0 to $misTE mismatches (txt)"} = $f; } - elsif ( $f =~ /TEs_reads_counts_mismatches\.txt$/) { $HTE{"read number per TE with 1 to $misTE mismatches (txt)"} = $f; } - elsif ( $f =~ /TEs_reads_counts_nomismatches\.txt$/) { $HTE{'read number per TE with no mismatch (txt)'} = $f; } - elsif ( $f =~ /TEs_unique_sorted\.bam$/) { $HTE{'TEs unique mappers (sorted bam)'} = $f; } - elsif ( $f =~ /TEs_sorted\.bam$/) { $HTE{'TEs mappers (sorted bam)'} = $f; } - elsif ( $fr =~ /.*Gviz_TEs/ ) - { - my $nu = $fr.'/*'; - @NonUniTE = glob $nu; - } - elsif ( $fr =~ /.*Gviz_genome/ ) - { - my $nu = $fr.'/rand/*'; - @NonUniG = glob $nu; - my $u = $fr.'/unique/*'; - @UniG = glob $u; - } - else { unlink $fr; } - } - return (\%Hex, \%HTE, \%HG, \@NonUniTE, \@NonUniG, \@UniG); -} - -sub header -{ - my $file = shift; - print $file " - - - - - pipeline - - - - - - - - - - - "; -} - -sub navbar -{ - my ( $file, $fastq, $actif ) = @_; - - print $file " -
-
-
- - Report -
-
    - "; - for (my $i = 0 ; $i <= $#{$fastq}; $i++) - { - # my $fa = basename($fastq->[$i],'.dat'); - my $fa = $fastq->[$i]; - if ($actif eq $fa){ print $file "
  • [$i].html\">$fa
  • ";} - else {print $file "
  • [$i].html\">$fa
  • " ;} - } - print $file " -
-
-
-
-
"; -} - -sub footer -{ - my $file = shift; - print $file " - -
- -
- - - - - - - - - - - - - "; -} - -sub carousel -{ - my ($file, $non_unique, $dir_root) = @_; - my $ac = 0; - print $file " -
-
-
-
-
-
-
-
-
-
Reads randomly assigned
-
-
- -
    - "; - foreach my $u (@{$non_unique}) - { - my $name = basename($u,'.png'); - $u = $1 if $u =~ /$dir_root(.*)/; - print $file " -
  • - $name -
  • - "; - } - print $file " -
-
-
-
-
- "; -} - -sub carousel2 -{ - my ($file, $unique, $non_unique, $dir_root) = @_; - print $file " -
-
-
-
-
-
-
-
-
-
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-transcripts-*distribution-*.png'; - @group = glob $group; - foreach (my $g =0; $g <= $#group; $g++) - { - if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-transcripts-.*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 " - -
-

$name

-

-

text file

-
- "; - $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; +package html; + +use strict; +use warnings; +use File::Basename; + +use Exporter; +our @ISA = qw( Exporter ); +our @EXPORT_OK = qw( &main_page &details_pages &menu_page &ppp_page ); + +sub main_page +{ + my ( $dir, $file, $list_mainTabP, $current, $ma, $ma_uni, $dir_root ) = @_; + my ( $futHashP, $uniqueTabP, $randTabP, $pngTabP ) = get_genome ( $dir, $dir_root ); + + open my $h, '>', $file || die "cannot create $file $!\n"; + header ( $h ); + navbar ( $h, $list_mainTabP, $current ); + print $h "\n"; + futurette( $h, $current, $pngTabP, $futHashP ); + print $h "

mappers #: $ma

unique mappers #: $ma_uni

\n"; + carousel2( $h, $uniqueTabP, $randTabP, $dir_root ); + footer($h); + close $h; +} + +sub menu_page +{ + my ( $dir, $file, $list_mainTabP, $current, $min, $max, $simin, $simax, $pimin, $pimax, $dir_root ) = @_; + my $html_ref = $1 if $dir =~ /$dir_root(.*)/; + open my $h, '>', $file || die "cannot create $file $!\n"; + header($h); + navbar ( $h, $list_mainTabP, $current ); + span( $h, $current, $min, $max, $simin, $simax, $pimin, $pimax ); + print $h "

\n"; + print $h " text file
\n
"; + footer($h); + close $h; +} + +sub details_pages +{ + my ( $dir_details, $prefix, $list_mainTabP, $current, $misTE, $dir_root, $ppp ) = @_; + my ($Hex, $HTE, $HG, $NonUniTE, $NonUniG, $UniG ) = get_subgroups( $dir_details, $current, $misTE, $dir_root ); + + my $html_ref = $1.'-PPP.html' if $prefix =~ /$dir_root(.*)/; + open my $h, '>', $prefix.'-TEs.html' || die "cannot create $prefix-TEs.html $!\n"; + header($h); + navbar ( $h, $list_mainTabP, $current ); + if ( $prefix =~ /piRNAs$/ && $ppp eq 'true' ) + { + print $h "
"; + print $h "

Ping Pong Partners

\n"; + print $h "
"; + } + fut($h,'Transposable elements',$HTE); + carousel($h,$NonUniTE,$dir_root); + footer($h); + close $h; + + open $h, '>', $prefix.'-genome.html' || die "cannot create $prefix-genome.html $!\n"; + header($h); + navbar ( $h, $list_mainTabP, $current ); + fut($h,'Genome',$HG); + carousel2($h,$UniG, $NonUniG,$dir_root); + footer($h); + close $h; + + open $h, '>', $prefix.'-transcripts.html' || die "cannot create $prefix-transcripts.html $!\n"; + header($h); + navbar ( $h, $list_mainTabP, $current ); + fut($h,'transcripts',$Hex); + footer($h); + close $h; +} + +sub ppp_page +{ + my ( $dir, $file, $list_mainTabP, $current, $ppp, $dir_root ) = @_; + + my $ppp_file = $ppp.'ppp.txt'; + open my $h, '>', $file || die "cannot create $file $!\n"; + header($h); + navbar ( $h, $list_mainTabP, $current ); + print $h '
'."\n"; + print $h ' + + + + + + + + + + + '; + + open my $f, '<', $ppp_file || die "cannot open $ppp_file $!\n"; + while ( <$f> ) + { + chomp; + print $h ''; + my ( $id, $sum, $ten, $mean, $sd, $zscore, $prob) = split /\t/, $_; + if( -d "$ppp/$id" ) + { + my $sub_html = $ppp.$id.'.html'; + my $sub_html_ref = $1.$id if $ppp =~ /$dir_root(.*)/; + print $h ""; + + open my $sub, '>', $sub_html || die "cannot create $sub_html\n"; + { + header($sub); + print $sub " +
+

$id

+

+

ping pong signature

+

sense reads with PPP

+

reverse reads with PPP

+

sense reads without PPP

+

reverse reads without PPP

+
"; + footer($sub); + } + close $sub; + + } + else { print $h "\n"; } + print $h "\n"; + + print $h ''; + } + close $f; + print $h "
IDoverlap sumten overlap summeanstandard deviationz-scorep-value
$id $id $sum $ten $mean $sd $zscore $prob
"; + footer($h); + close $h; +} + +sub get_genome +{ + my ( $dir, $dir_root ) = @_; + my ( %hash, @group, @Unique, @NonUnique, @png ); + + my $fut = $dir.'/*'; + my @fut = glob $fut; + + + foreach my $fr ( @fut ) + { + my $f = $1 if $fr =~ /$dir_root(.*)/; + if ( $fr =~ /.*Gviz/ ) + { + my $nu = $fr.'/rand/*'; + @NonUnique = glob $nu; + my $u = $fr.'/unique/*'; + @Unique = glob $u; + } + elsif ( $f =~ /.*distribution\.txt$/ ) { $hash{'mappers size distribution (txt)'} = $f; } + elsif ( $f =~ /.*distribution\.png$/ ) { push @png, $f; } + elsif ( $f =~ /.*unique\.fastq$/ ) { $hash{'unique mappers (fastq.gz)'} = $f.'.gz'; `gzip $fr`; } + elsif ( $f =~ /.*rejected\.fastq$/ ) { $hash{'unmapped (fastq.gz)'} = $f.'.gz'; `gzip $fr`; } + elsif ( $f =~ /.*all\.fastq$/ ) { $hash{'mappers (fastq.gz)'} = $f.'.gz'; `gzip $fr`; } + elsif ( $f =~ /.*dup_unique\.txt$/ ) { $hash{'unique mappers (txt)'} = $f; } + elsif ( $f =~ /.*dup_mapnum\.txt$/ ) { $hash{'mappers (txt)'} = $f; } + elsif ( $f =~ /.*dup_nonmapp\.txt$/ ) { $hash{'unmapped (txt)'} = $f; } + elsif ( $f =~ /.*_unique_sorted\.bam$/ ) { $hash{'unique alignment (bam)'} = $f; } + elsif ( $f =~ /.*_sorted\.bam$/ ) { $hash{'alignment (bam)'} = $f; } + elsif ( $f =~ /.*unique_plus.bedgraph/) { $hash{'bedgraph unique plus strand'} = $f; } + elsif ( $f =~ /.*unique_minus.bedgraph/) { $hash{'bedgraph unique minus strand'} = $f; } + elsif ( $f =~ /.*plus.bedgraph/) { $hash{'bedgraph plus strand'} = $f; } + elsif ( $f =~ /.*minus.bedgraph/) { $hash{'bedgraph minus strand'} = $f; } + else { unlink $fr; } + } + return (\%hash, \@Unique, \@NonUnique, \@png); +} + +sub span +{ + my ( $file, $name, $min, $max, $simin, $simax, $pimin, $pimax ) = @_; + + print $file " +
+
+
+

Bonafide

+ reads of size between $min and $max
with no mi, sn, t and r RNAs +

Genome

+

TE

+

Transcripts

+
+
+

siRNAs

+ bonafide reads of size between $simin and $simax +

Genome

+

TE

+

Transcripts

+
+
+

piRNAs

+ bonafide reads of size between $pimin and $pimax +

Genome

+

TE

+

Transcripts

+
+
+
+
+

miRNAs

+

Genome

+

TE

+

Transcripts

+
+
+
+"; +} + +sub get_subgroups +{ + my ( $dir, $name, $misTE, $dir_root ) = @_; + my (%Hex, %HTE, %HG, @group, @png, @pngTE, @NonUniTE, @UniG, @NonUniG ); + + my $fut = $dir.'/*'; + my @fut = glob $fut; + my $f =''; + foreach my $fr ( @fut ) + { + $f = $1 if $fr =~ /$dir_root(.*)/; + + if ( $f =~ /genome_unique_sorted\.bam$/ ) { $HG{'genome unique mappers (sorted bam)'} = $f; } + elsif ( $f =~ /genome_sorted\.bam$/ ) { $HG{'genome mappers (sorted bam)'} = $f; } + elsif ( $f =~ /miRNAs_reads_counts\.txt$/ ) { $HG{'miRNAs per type (txt)'} = $f; } + elsif ( $f =~ /genome_unique_plus\.bedgraph$/) { $HG{'bedgraph unique plus strand'} = $f; } + elsif ( $f =~ /genome_unique_minus\.bedgraph$/) { $HG{'bedgraph unique minus strand'} = $f; } + elsif ( $f =~ /genome_plus\.bedgraph$/) { $HG{'bedgraph plus strand'} = $f; } + elsif ( $f =~ /genome_minus\.bedgraph$/) { $HG{'bedgraph minus strand'} = $f; } + elsif ( $f =~ /TEs_plus\.bedgraph$/) { $HTE{'bedgraph plus strand'} = $f; } + elsif ( $f =~ /TEs_minus\.bedgraph$/) { $HTE{'bedgraph minus strand'} = $f; } + elsif ( $f =~ /transcripts_sorted\.bam$/) { $Hex{'transcripts mappers (sorted bam)'} = $f;} + elsif ( $f =~ /transcripts_unique_sorted\.bam$/) { $Hex{'transcripts unique mappers (sorted bam)'} = $f;} + elsif ( $f =~ /transcripts_reads_counts\.txt$/) { $Hex{'read number per transcript (txt)'} = $f;} + elsif ( $f =~ /TEs_reads_counts\.txt$/) { $HTE{"read number per TE 0 to $misTE mismatches (txt)"} = $f; } + elsif ( $f =~ /TEs_reads_counts_mismatches\.txt$/) { $HTE{"read number per TE with 1 to $misTE mismatches (txt)"} = $f; } + elsif ( $f =~ /TEs_reads_counts_nomismatches\.txt$/) { $HTE{'read number per TE with no mismatch (txt)'} = $f; } + elsif ( $f =~ /TEs_unique_sorted\.bam$/) { $HTE{'TEs unique mappers (sorted bam)'} = $f; } + elsif ( $f =~ /TEs_sorted\.bam$/) { $HTE{'TEs mappers (sorted bam)'} = $f; } + elsif ( $fr =~ /.*Gviz_TEs/ ) + { + my $nu = $fr.'/*'; + @NonUniTE = glob $nu; + } + elsif ( $fr =~ /.*Gviz_genome/ ) + { + my $nu = $fr.'/rand/*'; + @NonUniG = glob $nu; + my $u = $fr.'/unique/*'; + @UniG = glob $u; + } + else { unlink $fr; } + } + return (\%Hex, \%HTE, \%HG, \@NonUniTE, \@NonUniG, \@UniG); +} + +sub header +{ + my $file = shift; + print $file " + + + + + pipeline + + + + + + + + + + + "; +} + +sub navbar +{ + my ( $file, $fastq, $actif ) = @_; + + print $file " +
+
+
+ + Report +
+
    + "; + for (my $i = 0 ; $i <= $#{$fastq}; $i++) + { + # my $fa = basename($fastq->[$i],'.dat'); + my $fa = $fastq->[$i]; + if ($actif eq $fa){ print $file "
  • [$i].html\">$fa
  • ";} + else {print $file "
  • [$i].html\">$fa
  • " ;} + } + print $file " +
+
+
+
+
"; +} + +sub footer +{ + my $file = shift; + print $file " + +
+
+ +
+
+ + + + + + + + + + + + + "; +} + +sub carousel +{ + my ($file, $non_unique, $dir_root) = @_; + my $ac = 0; + print $file " +
+
+
+
+
+
+
+
+
+
Reads randomly assigned
+
+
+ +
    + "; + foreach my $u (@{$non_unique}) + { + my $name = basename($u,'.png'); + $u = $1 if $u =~ /$dir_root(.*)/; + print $file " +
  • + $name +
  • + "; + } + print $file " +
+
+
+
+
+ "; +} + +sub carousel2 +{ + my ($file, $unique, $non_unique, $dir_root) = @_; + print $file " +
+
+
+
+
+
+
+
+
+
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-transcripts-*distribution-*.png'; + @group = glob $group; + foreach (my $g =0; $g <= $#group; $g++) + { + if ($group[$g] =~ /.*($name-subgroups-bonafide_reads-transcripts-.*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 " + +
+

$name

+

+

text file

+
+ "; + $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; diff -r 221ea7307999 -r 263819fdda14 bin/js/filter.js --- a/bin/js/filter.js Thu Jul 12 08:56:18 2018 -0400 +++ b/bin/js/filter.js Thu Sep 06 10:21:30 2018 -0400 @@ -1,20 +1,20 @@ -function search(input) { - // Declare variables - var elt, filter, uls, li, a, i; - elt = input.parentElement; - filter = input.value.toUpperCase(); - uls = elt.getElementsByClassName('thumbs'); - - // Loop through all list items, and hide those who don't match the search query - for (j = 0; j < uls.length; j++) { - li = uls[j].getElementsByTagName('li'); - for (i = 0; i < li.length; i++) { - a = li[i].getElementsByTagName("a")[0]; - if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { - li[i].style.display = ""; - } else { - li[i].style.display = "none"; - } - } - } -} +function search(input) { + // Declare variables + var elt, filter, uls, li, a, i; + elt = input.parentElement; + filter = input.value.toUpperCase(); + uls = elt.getElementsByClassName('thumbs'); + + // Loop through all list items, and hide those who don't match the search query + for (j = 0; j < uls.length; j++) { + li = uls[j].getElementsByTagName('li'); + for (i = 0; i < li.length; i++) { + a = li[i].getElementsByTagName("a")[0]; + if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { + li[i].style.display = ""; + } else { + li[i].style.display = "none"; + } + } + } +} diff -r 221ea7307999 -r 263819fdda14 sRNAPipe.xml --- a/sRNAPipe.xml Thu Jul 12 08:56:18 2018 -0400 +++ b/sRNAPipe.xml Thu Sep 06 10:21:30 2018 -0400 @@ -86,6 +86,14 @@ samtools R perl + perl-getopt-long + perl-parallel-forkmanager + perl-statistics-r + perl-string-random + r-plotrix + bioconductor-sushi + r-colorbrewer + r-ggplot2 diff -r 221ea7307999 -r 263819fdda14 tool_dependencies.xml --- a/tool_dependencies.xml Thu Jul 12 08:56:18 2018 -0400 +++ b/tool_dependencies.xml Thu Sep 06 10:21:30 2018 -0400 @@ -1,27 +1,43 @@ - - - - - - - - - - - - - - - - - - https://depot.galaxyproject.org/software/plotrix/plotrix_3.6_src_all.tar.gz - https://depot.galaxyproject.org/software/bioconductor-sushi/bioconductor-sushi_1.14.0_src_all.tar.gz - https://depot.galaxyproject.org/software/RColorBrewer/RColorBrewer_1.1-2_src_all.tar.gz - https://depot.galaxyproject.org/software/ggplot2/ggplot2_1.0.1_src_all.tar.gz - https://depot.galaxyproject.org/software/perl-statistics-r/perl-statistics-r_0.34_src_all.tar.gz - https://cpan.metacpan.org/authors/id/Y/YA/YANICK/Parallel-ForkManager-1.19.tar.gz - https://cpan.metacpan.org/authors/id/F/FA/FANGLY/Statistics-R-0.34.tar.gz - https://cpan.metacpan.org/authors/id/J/JV/JV/Getopt-Long-2.50.tar.gz - https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/String-Random-0.29.tar.gz - + + + + + + + + + + + + + + + + + + + + + + + + + https://cpan.metacpan.org/authors/id/Y/YA/YANICK/Parallel-ForkManager-1.19.tar.gz + https://cpan.metacpan.org/authors/id/F/FA/FANGLY/Statistics-R-0.34.tar.gz + https://cpan.metacpan.org/authors/id/J/JV/JV/Getopt-Long-2.50.tar.gz + https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/String-Random-0.29.tar.gz + + + + + + https://depot.galaxyproject.org/software/plotrix/plotrix_3.6_src_all.tar.gz + https://depot.galaxyproject.org/software/bioconductor-sushi/bioconductor-sushi_1.14.0_src_all.tar.gz + https://depot.galaxyproject.org/software/RColorBrewer/RColorBrewer_1.1-2_src_all.tar.gz + https://depot.galaxyproject.org/software/ggplot2/ggplot2_1.0.1_src_all.tar.gz + https://depot.galaxyproject.org/software/perl-statistics-r/perl-statistics-r_0.34_src_all.tar.gz + + + + +