]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/swapcase_seq
refactoring of assemble_pairs
[biopieces.git] / bp_bin / swapcase_seq
index 9681ae2df1b1338e9c32038cf8e760303477f89f..b1fafa2ccd74cafe9783c3c9008b141426331296 100755 (executable)
@@ -1,6 +1,6 @@
 #!/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[:SEQ]
+    output.puts record
+  end
 end