]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/scores_to_dec
fixed SCORE_BASE global var
[biopieces.git] / bp_bin / scores_to_dec
index 9c94454be65b7028b20f1f2113fb086b37db1e2a..2d91c2bda001f24767f1208d5930291fe24d014b 100755 (executable)
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
-
-require 'biopieces'
+require 'maasha/biopieces'
+require 'maasha/seq'
 
 # Expading class Hash with possibly evil monkey patch.
 class Hash
   # Method to convert scores from ASCII encode string to
   # a semi-colon seperated string of decimal values.
-  def scores2dec!(base)
+  def scores2dec!
     if self.has_key? :SCORES
       self[:SCORES].gsub! /./ do |score|
-        score = (score.ord - base).to_s + ";"
+        score = (score.ord - Seq::SCORE_BASE).to_s + ";"
       end
 
       self[:SCORES].chomp! ";"
@@ -48,15 +48,12 @@ class Hash
   end
 end
 
-casts = []
-casts << {:long=>'base', :short=>'b', :type=>'uint', :mandatory=>false, :default=>64, :allowed=>"33,59,64", :disallowed=>nil}
-
-bp = Biopieces.new
+options = Biopieces.options_parse(ARGV)
 
-options = bp.parse(ARGV, casts)
-
-bp.each_record do |record|
-  bp.puts record.scores2dec!(options[:base])
+Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
+  input.each_record do |record|
+    output.puts record.scores2dec!
+  end
 end