#!/usr/bin/env ruby
-# Copyright (C) 2007-2010 Martin A. Hansen.
+# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-# Swap lowercase sequence to uppercase and visa versa for all sequences in the stream.
+# Swap lower case sequence to uppercase and visa versa for all sequences in the stream.
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-require 'biopieces'
+require 'maasha/biopieces'
-casts = []
+options = Biopieces.options_parse(ARGV)
-bp = Biopieces.new
-
-options = bp.parse(ARGV,casts)
-
-bp.each_record do |record|
- record["SEQ"].swapcase! if record.has_key? "SEQ"
- bp.puts record
+Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
+ input.each_record do |record|
+ record[:SEQ].swapcase! if record.has_key? :SEQ
+ output.puts record
+ end
end