X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fswapcase_seq;h=b1fafa2ccd74cafe9783c3c9008b141426331296;hb=dd65a9e6c523ee61c85ff0bfe00eaf1cc80be4c6;hp=62a69796b04e50b53ab529fd951e7db976d21758;hpb=3ca48a0dae0e1e58cc1ee42a13df2954c45abd71;p=biopieces.git diff --git a/bp_bin/swapcase_seq b/bp_bin/swapcase_seq index 62a6979..b1fafa2 100755 --- a/bp_bin/swapcase_seq +++ b/bp_bin/swapcase_seq @@ -1,40 +1,47 @@ #!/usr/bin/env ruby -require 'optparse' -require 'pp' +# Copyright (C) 2007-2011 Martin A. Hansen. -options = {} +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. -optparse = OptionParser.new do |opts| - opts.on( '-?', '--help', 'Display this screen' ) do - biopiece = $0.split( "/" ).last - exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki --help" - exit - end +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. - opts.on( '-v', '--verbose' ) do - options[ :verbose ] = true - end +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - opts.on( '-I', '--stream_in FILE', Time ) do |arg| - options[:stream_in] = arg - end +# http://www.gnu.org/copyleft/gpl.html -# opts.on( '-I', '--stream_in FILE', "Mandatory argument" ) do |arg| -# options[:stream_in] = arg -# end +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +# This program is part of the Biopieces framework (www.biopieces.org). + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +# Swap lower case sequence to uppercase and visa versa for all sequences in the stream. + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - opts.on( '-O', '--stream_in FILE', "Mandatory argument" ) do |arg| - options[:stream_out] = arg - end -end -optparse.parse! +require 'maasha/biopieces' -pp "Options:", options -pp "ARGV:", ARGV +options = Biopieces.options_parse(ARGV) -if ARGV.length == 0 then - biopiece = $0.split( "/" ).last - exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki" +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 + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +__END__