First complete Projects/Tasks build.
[htsworkflow.git] / htswanalysis / scripts / SummarizeProject2.pm
index 470e0a9546181f106e8cf242152f4163684e6fc0..546dd45af2e5a1aece1f14d38ad0b49d1b3fd8e7 100755 (executable)
@@ -2,6 +2,7 @@
 use strict;
 use warnings;
 use XML::Simple;
+my $root_dir = shift;
 my $library_info = shift;
 my %libs; 
 my %quest;
@@ -27,17 +28,17 @@ for my $i (0..scalar(@{$xml->{PeakCalling}})-1) {
   $desc{outfile} = "";
   $desc{fasta} = "";
   if($caller eq "QuEST") {
-    $desc{Summary} = `~/EXPTRACK/ProjectScripts/SummarizeQuEST.pm $caller_dir`;
+    $desc{Summary} = `$root_dir/scripts/SummarizeQuEST.pm $caller_dir`;
     $desc{outfile} = "$caller_dir/peak_caller.ChIP.out.bedgraph";
     $desc{fasta} = "$caller_dir/peak_caller.ChIP.out.fasta";
   } elsif($caller eq "WingPeaks") {
-    $desc{Summary} = `~/EXPTRACK/ProjectScripts/SummarizeWingPeaks.pm $caller_dir/$name.peaks`;
+    $desc{Summary} = `$root_dir/scripts/SummarizeWingPeaks.pm $caller_dir/$name.peaks`;
     $desc{outfile} = "$caller_dir/$name.peaks.bed";
     $desc{fasta} = "$caller_dir/$name.peaks.fasta";
   } elsif($caller eq "MACS") {
     my $peakfile = $caller_dir.'/'.$name.'_peaks.xls';
     my $negpeakfile = $caller_dir.'/'.$name.'_negative_peaks.xls';
-    $desc{Summary} = `~/EXPTRACK/ProjectScripts/SummarizeMACS.pm $peakfile $negpeakfile`;
+    $desc{Summary} = `$root_dir/scripts/SummarizeMACS.pm $peakfile $negpeakfile`;
     $desc{outfile} = "$caller_dir/".$name."_peaks.bed";
     $desc{fasta} = "$caller_dir/".$name."_peaks.fasta";
   }
@@ -62,7 +63,7 @@ for my $i (0..scalar(@{$xml->{qPCR}})-1) {
   $libs{$lib} = 0;
  
   if( ! -e $outfile ) {  $qPCR_Summary .= "<TR BCOLOR=#FFBBBB><TD>$name</TD><TD>Processing...</TD></TR>\n"; } else {
-    my $summary_line = `~/EXPTRACK/ProjectScripts/Summarize_qPCR.pm $name $lib $outfile`;
+    my $summary_line = `$root_dir/scripts/Summarize_qPCR.pm $name $lib $outfile`;
     if($summary_line eq "") { $qPCR_Summary .= "<TR BCOLOR=#FFBBBB><TD>$name</TD><TD>Processing...</TD></TR>\n"; }
     else {
       $qPCR_Summary .= $summary_line; 
@@ -99,18 +100,20 @@ for my $i (0..scalar(@{$xml->{CompareLibraries}})-1) {
   my $task = $xml->{CompareLibraries}->[$i]->{TaskId};
   my $tf = $xml->{CompareLibraries}->[$i]->{TF};
   my $genome = $xml->{CompareLibraries}->[$i]->{Genome};
-  my $features = "~/EXPTRACK/compare_peak_calls/".$genome."_uptream5k_downtream1k";
+  my $features = "$root_dir/reference_data/".$genome."_uptream5k_downtream1k";
   my $name1 = $xml->{CompareLibraries}->[$i]->{Library}->[0]->{Library};
   my $name2 = $xml->{CompareLibraries}->[$i]->{Library}->[1]->{Library};
   my $outfile = "../../Tasks/".$task.'/'.$name1."_".$name2.".compare";
   $libs{$name1} = 0; $libs{$name2} = 0;
   my $correlation;
-  if(-e $outfile) { $correlation = `cat $outfile | awk '{print \$8}'`; }
-  my $color; 
   if( !(-e $outfile) ) { $correlation = "In Progress..."; $color = "#FFBBBB"; } 
-  elsif($correlation > 0.9) { $color = "#BBFFBB"; }
-  elsif($correlation > 0.6) { $color = "#BBBBFF"; }
-  else { $color = "#FFBBBB"; }
+  else {
+    if(-e $outfile) { $correlation = `cat $outfile | awk '{print \$8}'`; }
+    my $color; 
+    elsif($correlation > 0.9) { $color = "#BBFFBB"; }
+    elsif($correlation > 0.6) { $color = "#BBBBFF"; }
+    else { $color = "#FFBBBB"; }
+  }
   $library_comparisons .= "<TR BGCOLOR=$color><TD>$tf</TD><TD>$name1</TD><TD>$name2</TD<TD>$correlation</TD></TR>\n";
 }
 $library_comparisons .= "</TABLE>\n";