From: martinahansen Date: Tue, 7 Jul 2009 20:24:39 +0000 (+0000) Subject: minor changes X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3ca48a0dae0e1e58cc1ee42a13df2954c45abd71;p=biopieces.git minor changes git-svn-id: http://biopieces.googlecode.com/svn/trunk@556 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/read_tab b/bp_bin/read_tab index 6517c0c..e7a443b 100755 --- a/bp_bin/read_tab +++ b/bp_bin/read_tab @@ -28,7 +28,6 @@ use strict; use Maasha::Filesys; -use Maasha::Fasta; use Maasha::Biopieces; @@ -70,7 +69,7 @@ if ( $options->{ 'data_in' } ) next; } - next if $line =~ /^#|^$/; + next if $line =~ /^#|^$/; # skip comment lines beginning with # and skip empty lines. chomp $line; diff --git a/bp_bin/swapcase_seq b/bp_bin/swapcase_seq index 06f6089..62a6979 100755 --- a/bp_bin/swapcase_seq +++ b/bp_bin/swapcase_seq @@ -1,37 +1,40 @@ #!/usr/bin/env ruby -require 'Maasha/biopieces' -require 'getoptlong' +require 'optparse' +require 'pp' -options = GetoptLong.new( - [ '--help', '-?', GetoptLong::NO_ARGUMENT ], - [ '--stream_in', '-I', GetoptLong::REQUIRED_ARGUMENT ], - [ '--stream_out', '-O', GetoptLong::REQUIRED_ARGUMENT ], - [ '--verbose', '-v', GetoptLong::NO_ARGUMENT ] -) +options = {} -if ARGV.length == 0 then - biopiece = $0.split( "/" ).last - exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki" -end +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 + + opts.on( '-v', '--verbose' ) do + options[ :verbose ] = true + end + + opts.on( '-I', '--stream_in FILE', Time ) do |arg| + options[:stream_in] = arg + end -options.each do | opt, arg | - puts "option: #{ opt } argument: #{ arg }" - - case opt - when '--help' - biopiece = $0.split( "/" ).last - exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki --help" - when '--stream_in' - puts "Stream in" - stream = File.open( arg ) - when '--stream_out' - puts "Stream out" - when '--verbose' - puts "blababnlbalbalbalbalab" - end +# opts.on( '-I', '--stream_in FILE', "Mandatory argument" ) do |arg| +# options[:stream_in] = arg +# end + + opts.on( '-O', '--stream_in FILE', "Mandatory argument" ) do |arg| + options[:stream_out] = arg + end end -bp_stream = BioPieces.new( "test.stream" ) +optparse.parse! + +pp "Options:", options +pp "ARGV:", ARGV -puts bp_stream.record_get +if ARGV.length == 0 then + biopiece = $0.split( "/" ).last + exec "print_wiki --data_in #{ ENV[ 'BP_DIR' ] }/bp_usage/#{ biopiece }.wiki" +end diff --git a/code_perl/Maasha/Biopieces.pm b/code_perl/Maasha/Biopieces.pm index 867f71b..61dfdf2 100644 --- a/code_perl/Maasha/Biopieces.pm +++ b/code_perl/Maasha/Biopieces.pm @@ -306,7 +306,6 @@ sub parse_options # ---- Adding the mandatory arguments to the arg_list ---- push @{ $arg_list }, ( - { long => 'help', short => '?', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, { long => 'stream_in', short => 'I', type => 'file!', mandatory => 'no', default => undef, allowed => undef, disallowed => undef }, { long => 'stream_out', short => 'O', type => 'file', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },