bin/br_bioflat.rb in bio-0.7.1 vs bin/br_bioflat.rb in bio-1.0.0

- old
+ new

@@ -1,27 +1,15 @@ #!/usr/bin/env ruby # -# bioflat - OBDA flat file indexer (executable) +# = bioflat - OBDA flat file indexer (executable) # -# Copyright (C) 2002 GOTO Naohisa <ngoto@gen-info.osaka-u.ac.jp> +# Copyright:: Copyright (C) 2002 +# Naohisa Goto <ng@bioruby.org> +# License:: Ruby's +# +# $Id: br_bioflat.rb,v 1.16 2006/02/22 07:01:05 ngoto Exp $ # -# 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. -# -# 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. -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# $Id: br_bioflat.rb,v 1.14 2003/08/27 17:28:30 ng Exp $ -# require 'bio' def usage print <<EOM @@ -149,11 +137,11 @@ when /^\-\-?renew/ options['renew'] = true else - STDERR.print "Warning: ignoring invalid option #{x.inspect}\n" + $stderr.print "Warning: ignoring invalid option #{x.inspect}\n" end end dbpath = File.join(location, dbname) unless dbpath if mode == :update then @@ -189,28 +177,28 @@ end dbname = ARGV.shift unless dbname dbname = File.join(location, dbname) unless location.to_s.empty? db = Bio::FlatFileIndex.open(dbname) ARGV.each do |key| - STDERR.print "Searching for \'#{key}\'...\n" + $stderr.print "Searching for \'#{key}\'...\n" #r = db.search(key) - #STDERR.print "OK, #{r.size} entry found\n" + #$stderr.print "OK, #{r.size} entry found\n" #if r.size > 0 then # print r #end begin if names.empty? then r = db.include?(key) else r = db.include_in_namespaces?(key, *names) end rescue RuntimeError - STDERR.print "ERROR: #{$!}\n" + $stderr.print "ERROR: #{$!}\n" next end r = [] unless r - STDERR.print "OK, #{r.size} entry found\n" + $stderr.print "OK, #{r.size} entry found\n" r.each do |i| print db.search_primary(i) end end db.close @@ -250,17 +238,17 @@ files.each do |x| k = Bio::FlatFile.autodetect_file(x) break if k end if k then - STDERR.print "Format: #{k.to_s}\n" + $stderr.print "Format: #{k.to_s}\n" format = k else - STDERR.print "ERROR: couldn't determine file format\n" + $stderr.print "ERROR: couldn't determine file format\n" return end end - STDERR.print "Namespaces: (first line: primary namespace)\n" + $stderr.print "Namespaces: (first line: primary namespace)\n" if format then parser = Bio::FlatFileIndex::Indexer::Parser.new(format) print parser.primary.name, "\n" puts parser.secondary.keys else