X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fread_sff;h=3de8b2ea1afea9e5a7e9213eac4913e8b7a01f01;hb=d5a8efe4d822a139b452bd35e2353aaccd84ac4c;hp=6e5febd247175040751cee158fa9123949ff6bbc;hpb=494dc53ebd515b1e3e9b91bbebf43059899ca4ce;p=biopieces.git diff --git a/bp_bin/read_sff b/bp_bin/read_sff index 6e5febd..3de8b2e 100755 --- a/bp_bin/read_sff +++ b/bp_bin/read_sff @@ -37,34 +37,34 @@ casts << {:long=>'num', :short=>'n', :type=>'uint', :mandatory=>false, :de casts << {:long=>'mask', :short=>'m', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} casts << {:long=>'clip', :short=>'c', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} -bp = Biopieces.new +options = Biopieces.options_parse(ARGV, casts) -options = bp.parse(ARGV, casts) - -bp.each_record do |record| - bp.puts record -end +Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| + input.each_record do |record| + output.puts record + end -num = 0 -last = false - -if options.has_key? :data_in - options[:data_in].each do |file| - SFF.open(file, mode='r') do |sff| - sff.each do |entry| - entry.mask if options[:mask] - entry.clip if options[:clip] - bp.puts entry.to_bp - num += 1 - - if options.has_key? :num and options[:num] == num - last = true - break + num = 0 + last = false + + if options.has_key? :data_in + options[:data_in].each do |file| + SFF.open(file, mode='r') do |sff| + sff.each do |entry| + entry.mask if options[:mask] + entry.clip if options[:clip] + output.puts entry.to_bp + num += 1 + + if options.has_key? :num and options[:num] == num + last = true + break + end end end - end - break if last + break if last + end end end