##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# 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.
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";
}