X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fplot_scores;h=8cc276d2f0e81055e2641bda2c0f683e183b4f94;hb=a2f82dca77855723ddc50dfb6a763da8558b7610;hp=ff476f47c7359ac4b1593063bc84e508929c2a09;hpb=6fd095e0d3ffdbe30d87c045320beadba3b63444;p=biopieces.git diff --git a/bp_bin/plot_scores b/bp_bin/plot_scores index ff476f4..8cc276d 100755 --- a/bp_bin/plot_scores +++ b/bp_bin/plot_scores @@ -25,9 +25,9 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'maasha/biopieces' +require 'maasha/seq' require 'gnuplot' require 'narray' -require 'pp' terminals = "dumb,x11,aqua,post,pdf,png,svg" title = "Mean Quality Scores" @@ -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 = 100_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" @@ -102,7 +99,7 @@ Gnuplot.open do |gp| if options[:count] plot.data << Gnuplot::DataSet.new([x, y2]) do |ds| - ds.with = "lines" + ds.with = "lines lt rgb \"black\"" ds.title = "relative count" end end