X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fprogress_meter;h=43cdd771d0b8e38d1d5733e83404082fde78d310;hb=d04a85629d2657266f42d30e5be6c8c03014d44a;hp=eca7c4b5862ec0fdc86b030b8b1cd112c010e8f5;hpb=e947b276fdbed92a3355454dd7246c4cca3c6315;p=biopieces.git diff --git a/bp_bin/progress_meter b/bp_bin/progress_meter index eca7c4b..43cdd77 100755 --- a/bp_bin/progress_meter +++ b/bp_bin/progress_meter @@ -29,20 +29,22 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -require 'biopieces' +require 'maasha/biopieces' casts = [] casts << {:long=>'no_stream', :short => 'x', :type => 'flag', :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil} casts << {:long=>'count', :short => 'c', :type => 'uint', :mandatory => false, :default => 1000, :allowed => nil, :disallowed => '0'} -bp = Biopieces.new +options = Biopieces.options_parse(ARGV, casts) -options = bp.parse(ARGV, casts) +Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| + input.each_with_index do |record, count| + output.puts record unless options[:no_stream] + $stderr.printf "\n% 9d ", count if (count % (options[:count] * 100)) == 0 + $stderr.print "." if (count % options[:count]) == 0 + end -bp.each_with_index do |record, count| - bp.puts record unless options.has_key? :no_stream - $stderr.printf "\n% 9d ", count if (count % (options[:count] * 100)) == 0 - $stderr.print "." if (count % options[:count]) == 0 + $stderr.puts end