# HG changeset patch
# User pierre.pouchin
# Date 1540381220 14400
# Node ID 9645d995fb3ce7dc259a2c3779c285ec4f81022d
# Parent eeb89c3331ada1b24e503a6edc8a64319e1d324c
Fix for spaces in datasets names.
diff -r eeb89c3331ad -r 9645d995fb3c bin/align.pm
--- a/bin/align.pm Tue Oct 23 11:02:17 2018 -0400
+++ b/bin/align.pm Wed Oct 24 07:40:20 2018 -0400
@@ -34,7 +34,7 @@
my $to_index = shift;
my $log = shift;
my $index_log = $to_index.'_index.err';
- `bwa index $to_index 2> $index_log`;
+ `bwa index '$to_index' 2> '$index_log'`;
print $log "Creating index for $to_index\n";
}
@@ -412,9 +412,9 @@
$view_err = $1.'_view.err';
$sort_err = $1.'_sort.err';
}
- `samtools view -Shb --threads $number_of_cpus $sam 2> $view_err | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> $sort_err > $bam_sorted`;
- `bedtools genomecov -scale $scale -strand + -bga -ibam $bam_sorted > $bedgraphP`;
- `bedtools genomecov -scale $scale -strand - -bga -ibam $bam_sorted > $bedgraphM`;
+ `samtools view -Shb --threads $number_of_cpus '$sam' 2> '$view_err' | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> '$sort_err' > '$bam_sorted'`;
+ `bedtools genomecov -scale $scale -strand + -bga -ibam '$bam_sorted' > '$bedgraphP'`;
+ `bedtools genomecov -scale $scale -strand - -bga -ibam '$bam_sorted' > '$bedgraphM'`;
}
sub sam_sorted_bam
@@ -428,7 +428,7 @@
$sort_err = $1.'_sort.err';
}
- `samtools view -Shb --threads $number_of_cpus $sam 2> $view_err | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> $sort_err > $bam_sorted`;
+ `samtools view -Shb --threads $number_of_cpus '$sam' 2> '$view_err' | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> '$sort_err' > '$bam_sorted'`;
}
sub BWA_call
@@ -436,8 +436,8 @@
my ( $index, $fastq, $sam, $mismatches, $number_of_cpus, $report ) = @_;
my ( $aln_err, $samse_err, $seq_num ) = ( $sam.'_aln.err', $sam.'_samse.err', 0 );
print $report "-----------------------------\n";
- print $report "bwa aln -t $number_of_cpus -n $mismatches $index $fastq 2> $aln_err | bwa samse $index /dev/stdin $fastq 2> $samse_err > $sam\n";
- `bwa aln -t $number_of_cpus -n $mismatches $index $fastq 2> $aln_err | bwa samse $index /dev/stdin $fastq 2> $samse_err > $sam `;
+ print $report "bwa aln -t $number_of_cpus -n $mismatches '$index' '$fastq' 2> '$aln_err' | bwa samse $index /dev/stdin '$fastq' 2> '$samse_err' > '$sam'\n";
+ `bwa aln -t $number_of_cpus -n $mismatches '$index' '$fastq' 2> '$aln_err' | bwa samse $index /dev/stdin '$fastq' 2> '$samse_err' > '$sam' `;
}
sub rpms_rpkm
diff -r eeb89c3331ad -r 9645d995fb3c bin/html.pm
--- a/bin/html.pm Tue Oct 23 11:02:17 2018 -0400
+++ b/bin/html.pm Wed Oct 24 07:40:20 2018 -0400
@@ -10,25 +10,25 @@
sub main_page
{
- my ( $dir, $file, $list_mainTabP, $current, $ma, $ma_uni, $dir_root ) = @_;
- my ( $futHashP, $uniqueTabP, $randTabP, $pngTabP ) = get_genome ( $dir, $dir_root );
+ 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;
+ 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 ( $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";
+ 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 );
@@ -40,7 +40,7 @@
sub details_pages
{
- my ( $dir_details, $prefix, $list_mainTabP, $current, $misTE, $dir_root, $ppp ) = @_;
+ 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(.*)/;
@@ -49,9 +49,9 @@
navbar ( $h, $list_mainTabP, $current );
if ( $prefix =~ /piRNAs$/ && $ppp eq 'true' )
{
- print $h " ";
+ print $h " ";
}
fut($h,'Transposable elements',$HTE);
carousel($h,$NonUniTE,$dir_root);
@@ -76,14 +76,14 @@
sub ppp_page
{
- my ( $dir, $file, $list_mainTabP, $current, $ppp, $dir_root ) = @_;
+ 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 '
+ 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 '
ID |
overlap sum |
@@ -96,22 +96,22 @@
';
- 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';
+ 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 " $id | ";
+ print $h " $id | ";
- open my $sub, '>', $sub_html || die "cannot create $sub_html\n";
- {
- header($sub);
- print $sub "
+ open my $sub, '>', $sub_html || die "cannot create $sub_html\n";
+ {
+ header($sub);
+ print $sub "
";
- footer($sub);
- }
- close $sub;
+ footer($sub);
+ }
+ close $sub;
+ }
+ else { print $h " $id | \n"; }
+ print $h " $sum | $ten | $mean | $sd | $zscore | $prob | \n";
- }
- else { print $h " $id | \n"; }
- print $h " $sum | $ten | $mean | $sd | $zscore | $prob | \n";
-
- print $h '
';
- }
- close $f;
- print $h "
";
- footer($h);
- close $h;
+ print $h '';
+ }
+ close $f;
+ print $h "
";
+ footer($h);
+ close $h;
}
sub get_genome
@@ -142,37 +141,37 @@
my ( $dir, $dir_root ) = @_;
my ( %hash, @group, @Unique, @NonUnique, @png );
- my $fut = $dir.'/*';
+ my $fut = "'$dir'".'/*';
my @fut = glob $fut;
- foreach my $fr ( @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; }
+ 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);
+ }
+ return (\%hash, \@Unique, \@NonUnique, \@png);
}
sub span
@@ -221,11 +220,11 @@
my ( $dir, $name, $misTE, $dir_root ) = @_;
my (%Hex, %HTE, %HG, @group, @png, @pngTE, @NonUniTE, @UniG, @NonUniG );
- my $fut = $dir.'/*';
+ my $fut = "'$dir'".'/*';
my @fut = glob $fut;
my $f ='';
- foreach my $fr ( @fut )
- {
+ foreach my $fr ( @fut )
+ {
$f = $1 if $fr =~ /$dir_root(.*)/;
if ( $f =~ /genome_unique_sorted\.bam$/ ) { $HG{'genome unique mappers (sorted bam)'} = $f; }
@@ -238,25 +237,25 @@
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_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;
- }
+ 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);
@@ -480,7 +479,7 @@
sub navbar
{
my ( $file, $fastq, $actif ) = @_;
-
+
print $file "