added: if peak score < zero put zero
authorRami Rauch <rrauch@stanford.edu>
Wed, 19 Nov 2008 18:45:58 +0000 (18:45 +0000)
committerRami Rauch <rrauch@stanford.edu>
Wed, 19 Nov 2008 18:45:58 +0000 (18:45 +0000)
htswanalysis/scripts/QuEST_2_narrowPeak.pm

index 35453177d4ca8dfcff4e5381e5c06ea90641ddcf..7f29b7acf145c30a53671ddf284871cf6bf28f24 100755 (executable)
@@ -5,7 +5,7 @@ use warnings;
 
  
 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-# Transform QuEST peakcalling .out file to naarowPeak format (see doc at http://genomewiki.ucsc.edu/EncodeDCC/index.php/File_Formats)
+# Transform QuEST peakcalling .out file to narrowPeak format (see doc at http://genomewiki.ucsc.edu/EncodeDCC/index.php/File_Formats)
 # Input rec example: chr8 w: 433 locmax: 5.68905 at: 126511693 nulls: 0.145256 ef: 27.6411204454239
 # w: we don't need.
 # locmax:is the absolute height of the peak. it does not correspond to the actual tag reads, because not all tags contribute equally to the peak determination.
@@ -98,8 +98,10 @@ while(<IFILE>)
     if($graphscore > $max){$max = $graphscore;}
     $bigscore = int( ($graphscore/$max)*1000 );
 
-    ##$BEDrec = "$chr\t$start\t$end\t$name\t$bigscore";
-    $NPrec = sprintf("%s\t%d\t%d\t%s\t%d\t%s\t%0.3f\t%s\t%d",$chr,$start,$end,$name,$bigscore,'.',$graphscore,'-1',$seqwindow); ## DBG: ,$bigscore,$score,$locmax,$ef);
+    if($bigscore < 0){$bigscore = 0;}
+    if($graphscore < 0){$graphscore = 0;}
+
+    $NPrec = sprintf("%s\t%d\t%d\t%s\t%d\t%s\t%0.3f\t%s\t%s\t%d",$chr,$start,$end,$name,$bigscore,'.',$graphscore,'-1','-1',$seqwindow); ##,'DBG:',$bigscore,$score,$locmax,$ef);
     print NPFILE "$NPrec\n";
 }