]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/plot_scores
fixed SCORE_BASE global var
[biopieces.git] / bp_bin / plot_scores
index bf0023a6ea53c9d611a9f993f89fb1a8c721d642..30ffeb3287dcffc20e44b05dbd01f6e1543abd4b 100755 (executable)
@@ -45,10 +45,7 @@ casts << {:long=>'ylabel',    :short=>'Y', :type=>'string', :mandatory=>false, :
 
 options = Biopieces.options_parse(ARGV, casts)
 
-ILLUMINA_BASE = 64
-ILLUMINA_MIN  = 0
-ILLUMINA_MAX  = 40
-SCORES_MAX    = 10_000
+SCORES_MAX = 10_000
 
 scores_vec = NArray.int(SCORES_MAX)
 count_vec  = NArray.int(SCORES_MAX)
@@ -62,7 +59,7 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
       if scores.length > 0
         raise BiopiecesError, "score string too long: #{scores.length} > #{SCORES_MAX}" if scores.length > SCORES_MAX
 
-        scores_vec[0 ... scores.length] += NArray.to_na(scores, "byte") - ILLUMINA_BASE
+        scores_vec[0 ... scores.length] += NArray.to_na(scores, "byte") - Seq::SCORE_BASE
         count_vec[0 ... scores.length]  += 1
 
         max = scores.length if scores.length > max
@@ -76,7 +73,7 @@ end
 mean_vec   = NArray.sfloat(max)
 mean_vec   = scores_vec[0 ... max].to_f / count_vec[0 ... max]
 count_vec  = count_vec[0 ... max].to_f
-count_vec *= (ILLUMINA_MAX / count_vec.max(0).to_f)
+count_vec *= (Seq::SCORE_MAX / count_vec.max(0).to_f)
 
 x  = (1 .. max).to_a
 y1 = mean_vec.to_a
@@ -90,7 +87,7 @@ Gnuplot.open do |gp|
     plot.ylabel   options[:ylabel]
     plot.output   options[:data_out] if options[:data_out]
     plot.xrange   "[#{x.min - 1}:#{x.max + 1}]"
-    plot.yrange   "[#{ILLUMINA_MIN}:#{ILLUMINA_MAX}]"
+    plot.yrange   "[#{Seq::SCORE_MIN}:#{Seq::SCORE_MAX}]"
     plot.style    "fill solid 0.5 border"
     plot.xtics    "out"
     plot.ytics    "out"