require 'maasha/biopieces'
-casts = []
-
-bp = Biopieces.new
-
-options = bp.parse(ARGV, casts)
+options = Biopieces.options_parse(ARGV)
records = []
-bp.each_record do |record|
- records << record
-end
+Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
+ input.each_record do |record|
+ records << record
+ end
-records.shuffle.each do |record|
- bp.puts record
+ records.shuffle.each do |record|
+ output.puts record
+ end
end