X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fscores_to_dec;h=2d91c2bda001f24767f1208d5930291fe24d014b;hb=dfe922540177aeaad25c2da595b9bac1a2205c27;hp=c5e7c1e2361788f51471f99886d11a400ca33948;hpb=494dc53ebd515b1e3e9b91bbebf43059899ca4ce;p=biopieces.git diff --git a/bp_bin/scores_to_dec b/bp_bin/scores_to_dec index c5e7c1e..2d91c2b 100755 --- a/bp_bin/scores_to_dec +++ b/bp_bin/scores_to_dec @@ -28,10 +28,8 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - require 'maasha/biopieces' - -ILLUMINA_BASE = 64 +require 'maasha/seq' # Expading class Hash with possibly evil monkey patch. class Hash @@ -40,7 +38,7 @@ class Hash def scores2dec! if self.has_key? :SCORES self[:SCORES].gsub! /./ do |score| - score = (score.ord - ILLUMINA_BASE).to_s + ";" + score = (score.ord - Seq::SCORE_BASE).to_s + ";" end self[:SCORES].chomp! ";" @@ -50,14 +48,12 @@ class Hash end end -casts = [] - -bp = Biopieces.new +options = Biopieces.options_parse(ARGV) -options = bp.parse(ARGV, casts) - -bp.each_record do |record| - bp.puts record.scores2dec! +Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| + input.each_record do |record| + output.puts record.scores2dec! + end end