[BioRuby-cvs] bioruby/lib/bio/io brdb.rb, 1.2, 1.3 das.rb, 1.7, 1.8 dbget.rb, 1.9, 1.10 flatfile.rb, 1.35, 1.36 pubmed.rb, 1.11, 1.12 registry.rb, 1.12, 1.13 sql.rb, 1.2, 1.3

Katayama Toshiaki k at pub.open-bio.org
Wed Sep 7 21:22:14 EDT 2005


Update of /home/repository/bioruby/bioruby/lib/bio/io
In directory pub.open-bio.org:/tmp/cvs-serv9021/lib/bio/io

Modified Files:
	brdb.rb das.rb dbget.rb flatfile.rb pubmed.rb registry.rb 
	sql.rb 
Log Message:
* expanded tab at the line head


Index: pubmed.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/pubmed.rb,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** pubmed.rb	5 Feb 2004 12:58:57 -0000	1.11
--- pubmed.rb	8 Sep 2005 01:22:12 -0000	1.12
***************
*** 36,43 ****
        result = response.body
        if result =~ /#{id}\s+Error/
! 	raise( result )
        else
! 	result = result.gsub("\r", "\n").squeeze("\n").gsub(/<\/?pre>/, '')
! 	return result
        end
      end
--- 36,43 ----
        result = response.body
        if result =~ /#{id}\s+Error/
!         raise( result )
        else
!         result = result.gsub("\r", "\n").squeeze("\n").gsub(/<\/?pre>/, '')
!         return result
        end
      end
***************
*** 51,58 ****
        result = response.body
        if result =~ /#{id}\s+Error/
! 	raise( result )
        else
! 	result = result.gsub("\r", "\n").squeeze("\n").gsub(/<\/?pre>/, '')
! 	return result
        end
      end
--- 51,58 ----
        result = response.body
        if result =~ /#{id}\s+Error/
!         raise( result )
        else
!         result = result.gsub("\r", "\n").squeeze("\n").gsub(/<\/?pre>/, '')
!         return result
        end
      end

Index: registry.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/registry.rb,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** registry.rb	15 Feb 2004 01:44:02 -0000	1.12
--- registry.rb	8 Sep 2005 01:22:12 -0000	1.13
***************
*** 39,49 ****
        env_path = ENV['OBDA_SEARCH_PATH']
        if env_path and env_path.size > 0
! 	read_env(env_path)
        else
! 	read_local("#{ENV['HOME']}/.bioinformatics/seqdatabase.ini")
! 	read_local("/etc/bioinformatics/seqdatabase.ini")
! 	if @registry.empty?
! 	  read_remote("http://www.open-bio.org/registry/seqdatabase.ini")
! 	end
        end
      end
--- 39,49 ----
        env_path = ENV['OBDA_SEARCH_PATH']
        if env_path and env_path.size > 0
!         read_env(env_path)
        else
!         read_local("#{ENV['HOME']}/.bioinformatics/seqdatabase.ini")
!         read_local("/etc/bioinformatics/seqdatabase.ini")
!         if @registry.empty?
!           read_remote("http://www.open-bio.org/registry/seqdatabase.ini")
!         end
        end
      end
***************
*** 51,68 ****
      def get_database(dbname)
        @registry.each do |db|
! 	if db.database == dbname.downcase
! 	  case db.protocol
! 	  when 'biofetch'
! 	    return serv_biofetch(db)
! 	  when 'biosql'
! 	    return serv_biosql(db)
! 	  when 'flat', 'index-flat', 'index-berkeleydb'
! 	    return serv_flat(db)
! 	  when 'bsane-corba', 'biocorba'
! 	    raise NotImplementedError
! 	  when 'xembl'
! 	    raise NotImplementedError
! 	  end
! 	end
        end
        return nil
--- 51,68 ----
      def get_database(dbname)
        @registry.each do |db|
!         if db.database == dbname.downcase
!           case db.protocol
!           when 'biofetch'
!             return serv_biofetch(db)
!           when 'biosql'
!             return serv_biosql(db)
!           when 'flat', 'index-flat', 'index-berkeleydb'
!             return serv_flat(db)
!           when 'bsane-corba', 'biocorba'
!             raise NotImplementedError
!           when 'xembl'
!             raise NotImplementedError
!           end
!         end
        end
        return nil
***************
*** 72,76 ****
      def query(dbname)
        @registry.each do |db|
! 	return db if db.database == dbname.downcase
        end
      end
--- 72,76 ----
      def query(dbname)
        @registry.each do |db|
!         return db if db.database == dbname.downcase
        end
      end
***************
*** 80,88 ****
      def read_env(path)
        path.split('+').each do |elem|
! 	if /:/.match(elem)
! 	  read_remote(elem)
! 	else
! 	  read_local(elem)
! 	end
        end
      end
--- 80,88 ----
      def read_env(path)
        path.split('+').each do |elem|
!         if /:/.match(elem)
!           read_remote(elem)
!         else
!           read_local(elem)
!         end
        end
      end
***************
*** 90,95 ****
      def read_local(file)
        if File.readable?(file)
! 	stanza = File.open(file).read
! 	parse_stanza(stanza)
        end
      end
--- 90,95 ----
      def read_local(file)
        if File.readable?(file)
!         stanza = File.open(file).read
!         parse_stanza(stanza)
        end
      end
***************
*** 98,103 ****
        schema, user, host, port, reg, path, = URI.split(url)
        Net::HTTP.start(host, port) do |http|
! 	response, = http.get(path)
! 	parse_stanza(response.body)
        end
      end
--- 98,103 ----
        schema, user, host, port, reg, path, = URI.split(url)
        Net::HTTP.start(host, port) do |http|
!         response, = http.get(path)
!         parse_stanza(response.body)
        end
      end
***************
*** 106,122 ****
        return unless stanza
        if stanza[/.*/] =~ /VERSION\s*=\s*(\S+)/
! 	@spec_version = $1	# for internal use (may differ on each file)
! 	stanza[/.*/] = ''	# remove VERSION line
        end
        stanza.each_line do |line|
! 	case line
! 	when /^\[(.*)\]/
            dbname = $1.downcase
! 	  db = Bio::Registry::DB.new($1)
! 	  @registry.push(db)
! 	when /=/
! 	  tag, value = line.chomp.split(/\s*=\s*/)
! 	  @registry.last[tag] = value
! 	end
        end
      end
--- 106,122 ----
        return unless stanza
        if stanza[/.*/] =~ /VERSION\s*=\s*(\S+)/
!         @spec_version = $1	# for internal use (may differ on each file)
!         stanza[/.*/] = ''	# remove VERSION line
        end
        stanza.each_line do |line|
!         case line
!         when /^\[(.*)\]/
            dbname = $1.downcase
!           db = Bio::Registry::DB.new($1)
!           @registry.push(db)
!         when /=/
!           tag, value = line.chomp.split(/\s*=\s*/)
!           @registry.last[tag] = value
!         end
        end
      end
***************
*** 134,140 ****
        case db.driver
        when /mysql/i
! 	driver = 'Mysql'
        when /pg|postgres/i
! 	driver = 'Pg'
        when /oracle/
        when /sybase/
--- 134,140 ----
        case db.driver
        when /mysql/i
!         driver = 'Mysql'
        when /pg|postgres/i
!         driver = 'Pg'
        when /oracle/
        when /sybase/
***************
*** 168,182 ****
  
        def initialize(dbname)
! 	@database = dbname
! 	@property = Hash.new
        end
        attr_reader :database
  
        def method_missing(meth_id)
! 	@property[meth_id.id2name]
        end
  
        def []=(tag, value)
! 	@property[tag] = value
        end
  
--- 168,182 ----
  
        def initialize(dbname)
!         @database = dbname
!         @property = Hash.new
        end
        attr_reader :database
  
        def method_missing(meth_id)
!         @property[meth_id.id2name]
        end
  
        def []=(tag, value)
!         @property[tag] = value
        end
  

Index: brdb.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/brdb.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** brdb.rb	26 Jun 2002 00:12:29 -0000	1.2
--- brdb.rb	8 Sep 2005 01:22:11 -0000	1.3
***************
*** 36,41 ****
      def fetch(db_table, entry_id)
        DBI.connect(*@brdb) do |dbh|
! 	query = "select * from #{db_table} where id = ?"
! 	dbh.execute(query, entry_id).fetch_all
        end
      end
--- 36,41 ----
      def fetch(db_table, entry_id)
        DBI.connect(*@brdb) do |dbh|
!         query = "select * from #{db_table} where id = ?"
!         dbh.execute(query, entry_id).fetch_all
        end
      end
***************
*** 43,51 ****
      def insert(db_table, values)
        if values.is_a?(Array)
! 	values = values.map{ |x| '"' + DBI.quote(x) + '"' }.join(",")
        end
        DBI.connect(*@brdb) do |dbh|
! 	query = "insert into #{db_table} values (?);"
! 	dbh.execute(query, values)
        end
      end
--- 43,51 ----
      def insert(db_table, values)
        if values.is_a?(Array)
!         values = values.map{ |x| '"' + DBI.quote(x) + '"' }.join(",")
        end
        DBI.connect(*@brdb) do |dbh|
!         query = "insert into #{db_table} values (?);"
!         dbh.execute(query, values)
        end
      end
***************
*** 53,61 ****
      def update(db_table, entry_id, values)
        if values.is_a?(Hash)
! 	values = values.to_a.map{ |k, v| "#{k}='#{DBI.quote(v)}'" }.join(',')
        end
        DBI.connect(*@brdb) do |dbh|
! 	query = "update #{db_table} set ? where id = ?"
! 	dbh.execute(query, values, entry_id)
        end
      end
--- 53,61 ----
      def update(db_table, entry_id, values)
        if values.is_a?(Hash)
!         values = values.to_a.map{ |k, v| "#{k}='#{DBI.quote(v)}'" }.join(',')
        end
        DBI.connect(*@brdb) do |dbh|
!         query = "update #{db_table} set ? where id = ?"
!         dbh.execute(query, values, entry_id)
        end
      end

Index: dbget.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/dbget.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** dbget.rb	24 Aug 2004 00:05:58 -0000	1.9
--- dbget.rb	8 Sep 2005 01:22:11 -0000	1.10
***************
*** 35,41 ****
  
        unless serv or port		# if both of serv and port are nil
! 	if ENV["DBGET"] =~ /:/		# and ENV["DBGET"] exists
! 	  serv, port = ENV["DBGET"].split(':')
! 	end
        end
        serv = serv ? serv : SERV
--- 35,41 ----
  
        unless serv or port		# if both of serv and port are nil
!         if ENV["DBGET"] =~ /:/		# and ENV["DBGET"] exists
!           serv, port = ENV["DBGET"].split(':')
!         end
        end
        serv = serv ? serv : SERV
***************
*** 43,47 ****
  
        if arg.empty?
! 	arg = "-h"			# DBGET help message
        end
  
--- 43,47 ----
  
        if arg.empty?
!         arg = "-h"			# DBGET help message
        end
  

Index: das.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/das.rb,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** das.rb	26 Aug 2004 10:25:35 -0000	1.7
--- das.rb	8 Sep 2005 01:22:11 -0000	1.8
***************
*** 47,52 ****
          dsn = DSN.new
          e.elements.each do |e|
! 	  case e.name
! 	  when 'SOURCE'
              dsn.source = e.text
              dsn.source_id = e.attributes['id']
--- 47,52 ----
          dsn = DSN.new
          e.elements.each do |e|
!           case e.name
!           when 'SOURCE'
              dsn.source = e.text
              dsn.source_id = e.attributes['id']
***************
*** 70,85 ****
        doc = REXML::Document.new(result.body)
        doc.elements.each('/descendant::ENTRY_POINTS') do |e|
! 	entry_point.href = e.attributes['href']
! 	entry_point.version = e.attributes['version']
! 	e.elements.each do |e|
! 	  segment = SEGMENT.new
! 	  segment.entry_id = e.attributes['id']
! 	  segment.start = e.attributes['start']
! 	  segment.stop = e.attributes['stop']
! 	  segment.stop = e.attributes['orientation']
! 	  segment.subparts = e.attributes['subparts']
! 	  segment.description = e.text
! 	  entry_point.segments << segment
! 	end
        end
        entry_point
--- 70,85 ----
        doc = REXML::Document.new(result.body)
        doc.elements.each('/descendant::ENTRY_POINTS') do |e|
!         entry_point.href = e.attributes['href']
!         entry_point.version = e.attributes['version']
!         e.elements.each do |e|
!           segment = SEGMENT.new
!           segment.entry_id = e.attributes['id']
!           segment.start = e.attributes['start']
!           segment.stop = e.attributes['stop']
!           segment.stop = e.attributes['orientation']
!           segment.subparts = e.attributes['subparts']
!           segment.description = e.text
!           entry_point.segments << segment
!         end
        end
        entry_point
***************
*** 94,98 ****
        opts = []
        segments.each do |s|
! 	opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
        end
        query = opts.join(';')
--- 94,98 ----
        opts = []
        segments.each do |s|
!         opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
        end
        query = opts.join(';')
***************
*** 101,113 ****
        doc = REXML::Document.new(result.body)
        doc.elements.each('/descendant::SEQUENCE') do |e|
! 	sequence = DNA.new
! 	sequence.entry_id = e.attributes['id']
! 	sequence.start = e.attributes['start']
! 	sequence.stop = e.attributes['stop']
! 	sequence.version = e.attributes['version']
! 	e.elements.each do |e|
! 	  sequence.sequence = Bio::Sequence::NA.new(e.text)
! 	  sequence.length = e.attributes['length'].to_i
! 	end
          ary << sequence
        end
--- 101,113 ----
        doc = REXML::Document.new(result.body)
        doc.elements.each('/descendant::SEQUENCE') do |e|
!         sequence = DNA.new
!         sequence.entry_id = e.attributes['id']
!         sequence.start = e.attributes['start']
!         sequence.stop = e.attributes['stop']
!         sequence.version = e.attributes['version']
!         e.elements.each do |e|
!           sequence.sequence = Bio::Sequence::NA.new(e.text)
!           sequence.length = e.attributes['length'].to_i
!         end
          ary << sequence
        end
***************
*** 123,127 ****
        opts = []
        segments.each do |s|
! 	opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
        end
        query = opts.join(';')
--- 123,127 ----
        opts = []
        segments.each do |s|
!         opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
        end
        query = opts.join(';')
***************
*** 130,147 ****
        doc = REXML::Document.new(result.body)
        doc.elements.each('/descendant::SEQUENCE') do |e|
! 	sequence = SEQUENCE.new
! 	sequence.entry_id = e.attributes['id']
! 	sequence.start = e.attributes['start']
! 	sequence.stop = e.attributes['stop']
! 	sequence.moltype = e.attributes['moltype']
! 	sequence.version = e.attributes['version']
! 	case sequence.moltype
! 	when /dna|rna/i		# 'DNA', 'ssRNA', 'dsRNA'
! 	  sequence.sequence = Bio::Sequence::NA.new(e.text)
! 	when /protein/i		# 'Protein
! 	  sequence.sequence = Bio::Sequence::AA.new(e.text)
! 	else
! 	  sequence.sequence = e.text
! 	end
          ary << sequence
        end
--- 130,147 ----
        doc = REXML::Document.new(result.body)
        doc.elements.each('/descendant::SEQUENCE') do |e|
!         sequence = SEQUENCE.new
!         sequence.entry_id = e.attributes['id']
!         sequence.start = e.attributes['start']
!         sequence.stop = e.attributes['stop']
!         sequence.moltype = e.attributes['moltype']
!         sequence.version = e.attributes['version']
!         case sequence.moltype
!         when /dna|rna/i		# 'DNA', 'ssRNA', 'dsRNA'
!           sequence.sequence = Bio::Sequence::NA.new(e.text)
!         when /protein/i		# 'Protein
!           sequence.sequence = Bio::Sequence::AA.new(e.text)
!         else
!           sequence.sequence = e.text
!         end
          ary << sequence
        end
***************
*** 157,161 ****
        opts = []
        segments.each do |s|
! 	opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
        end
        query = opts.join(';')
--- 157,161 ----
        opts = []
        segments.each do |s|
!         opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
        end
        query = opts.join(';')
***************
*** 164,186 ****
        doc = REXML::Document.new(result.body)
        doc.elements.each('/descendant::GFF') do |e|
! 	types.version = e.attributes['version']
! 	types.href = e.attributes['href']
! 	e.elements.each do |e|
! 	  segment = SEGMENT.new
! 	  segment.entry_id = e.attributes['id']
! 	  segment.start = e.attributes['start']
! 	  segment.stop = e.attributes['stop']
! 	  segment.version = e.attributes['version']
! 	  segment.label = e.attributes['label']
! 	  e.elements.each do |e|
! 	    t = TYPE.new
! 	    t.entry_id = e.attributes['id']
! 	    t.method = e.attributes['method']
! 	    t.category = e.attributes['category']
! 	    t.count = e.text.to_i
! 	    segment.types << t
! 	  end
! 	  types.segments << segment
! 	end
        end
        types
--- 164,186 ----
        doc = REXML::Document.new(result.body)
        doc.elements.each('/descendant::GFF') do |e|
!         types.version = e.attributes['version']
!         types.href = e.attributes['href']
!         e.elements.each do |e|
!           segment = SEGMENT.new
!           segment.entry_id = e.attributes['id']
!           segment.start = e.attributes['start']
!           segment.stop = e.attributes['stop']
!           segment.version = e.attributes['version']
!           segment.label = e.attributes['label']
!           e.elements.each do |e|
!             t = TYPE.new
!             t.entry_id = e.attributes['id']
!             t.method = e.attributes['method']
!             t.category = e.attributes['category']
!             t.count = e.text.to_i
!             segment.types << t
!           end
!           types.segments << segment
!         end
        end
        types
***************
*** 196,209 ****
        opts = []
        segments.each do |s|
! 	opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
        end
        if categorize
! 	opts << "categorize=yes"	# default is 'no'
        end
        feature_ids.each do |fid|
! 	opts << "feature_id=#{fid}"
        end
        group_ids.each do |gid|
! 	opts << "group_id=#{gid}"
        end
        query = opts.join(';')
--- 196,209 ----
        opts = []
        segments.each do |s|
!         opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
        end
        if categorize
!         opts << "categorize=yes"	# default is 'no'
        end
        feature_ids.each do |fid|
!         opts << "feature_id=#{fid}"
        end
        group_ids.each do |gid|
!         opts << "group_id=#{gid}"
        end
        query = opts.join(';')
***************
*** 215,294 ****
          gff.href = e.attributes['href']
          e.elements.each('SEGMENT') do |e|
! 	  segment = SEGMENT.new
! 	  segment.entry_id = e.attributes['id']
! 	  segment.start = e.attributes['start']
! 	  segment.stop = e.attributes['stop']
! 	  segment.version = e.attributes['version']
! 	  segment.label = e.attributes['label']
! 	  e.elements.each do |e|
! 	    feature = FEATURE.new
! 	    feature.entry_id = e.attributes['id']
! 	    feature.label = e.attributes['label']
! 	    e.elements.each do |e|
! 	      case e.name
! 	      when 'TYPE'
! 		type = TYPE.new
! 		type.entry_id = e.attributes['id']
! 		type.category = e.attributes['category']
! 		type.reference = e.attributes['referrence']
! 		type.label = e.text
! 		feature.types << type
! 	      when 'METHOD'
! 		feature.method_id = e.attributes['id']
! 		feature.method = e.text
! 	      when 'START'
! 		feature.start = e.text
! 	      when 'STOP', 'END'
! 		feature.stop = e.text
! 	      when 'SCORE'
! 		feature.score = e.text
! 	      when 'ORIENTATION'
! 		feature.orientation = e.text
! 	      when 'PHASE'
! 		feature.phase = e.text
! 	      when 'NOTE'
! 		feature.notes << e.text
! 	      when 'LINK'
! 		link = LINK.new
! 		link.href = e.attributes['href']
! 		link.text = e.text
! 		feature.links << link
! 	      when 'TARGET'
! 		target = TARGET.new
! 		target.entry_id = e.attributes['id']
! 		target.start = e.attributes['start']
! 		target.stop = e.attributes['stop']
! 		target.name = e.text
! 		feature.targets << target
! 	      when 'GROUP'
! 		group = GROUP.new
! 		group.entry_id = e.attributes['id']
! 		group.label = e.attributes['label']
! 		group.type = e.attributes['type']
! 		e.elements.each do |e|
! 		  case e.name
! 		  when 'NOTE'		# in GROUP
! 		    group.notes << e.text
! 		  when 'LINK'		# in GROUP
! 		    link = LINK.new
! 		    link.href = e.attributes['href']
! 		    link.text = e.text
! 		    group.links << link
! 		  when 'TARGET'		# in GROUP
! 		    target = TARGET.new
! 		    target.entry_id = e.attributes['id']
! 		    target.start = e.attributes['start']
! 		    target.stop = e.attributes['stop']
! 		    target.name = e.text
! 		    group.targets << target
! 		  end
! 		end
! 		feature.groups << group
! 	      end
! 	    end
! 	    segment.features << feature
! 	  end
! 	  gff.segments << segment
! 	end
        end
        gff
--- 215,294 ----
          gff.href = e.attributes['href']
          e.elements.each('SEGMENT') do |e|
!           segment = SEGMENT.new
!           segment.entry_id = e.attributes['id']
!           segment.start = e.attributes['start']
!           segment.stop = e.attributes['stop']
!           segment.version = e.attributes['version']
!           segment.label = e.attributes['label']
!           e.elements.each do |e|
!             feature = FEATURE.new
!             feature.entry_id = e.attributes['id']
!             feature.label = e.attributes['label']
!             e.elements.each do |e|
!               case e.name
!               when 'TYPE'
!                 type = TYPE.new
!                 type.entry_id = e.attributes['id']
!                 type.category = e.attributes['category']
!                 type.reference = e.attributes['referrence']
!                 type.label = e.text
!                 feature.types << type
!               when 'METHOD'
!                 feature.method_id = e.attributes['id']
!                 feature.method = e.text
!               when 'START'
!                 feature.start = e.text
!               when 'STOP', 'END'
!                 feature.stop = e.text
!               when 'SCORE'
!                 feature.score = e.text
!               when 'ORIENTATION'
!                 feature.orientation = e.text
!               when 'PHASE'
!                 feature.phase = e.text
!               when 'NOTE'
!                 feature.notes << e.text
!               when 'LINK'
!                 link = LINK.new
!                 link.href = e.attributes['href']
!                 link.text = e.text
!                 feature.links << link
!               when 'TARGET'
!                 target = TARGET.new
!                 target.entry_id = e.attributes['id']
!                 target.start = e.attributes['start']
!                 target.stop = e.attributes['stop']
!                 target.name = e.text
!                 feature.targets << target
!               when 'GROUP'
!                 group = GROUP.new
!                 group.entry_id = e.attributes['id']
!                 group.label = e.attributes['label']
!                 group.type = e.attributes['type']
!                 e.elements.each do |e|
!                   case e.name
!                   when 'NOTE'		# in GROUP
!                     group.notes << e.text
!                   when 'LINK'		# in GROUP
!                     link = LINK.new
!                     link.href = e.attributes['href']
!                     link.text = e.text
!                     group.links << link
!                   when 'TARGET'		# in GROUP
!                     target = TARGET.new
!                     target.entry_id = e.attributes['id']
!                     target.start = e.attributes['start']
!                     target.stop = e.attributes['stop']
!                     target.name = e.text
!                     group.targets << target
!                   end
!                 end
!                 feature.groups << group
!               end
!             end
!             segment.features << feature
!           end
!           gff.segments << segment
!         end
        end
        gff
***************
*** 298,307 ****
      class DSN
        attr_accessor :source, :source_id, :source_version,
! 	:mapmaster, :description, :description_href
      end
  
      class ENTRY_POINT
        def initialize
! 	@segments = Array.new
        end
        attr_reader :segments
--- 298,307 ----
      class DSN
        attr_accessor :source, :source_id, :source_version,
!         :mapmaster, :description, :description_href
      end
  
      class ENTRY_POINT
        def initialize
!         @segments = Array.new
        end
        attr_reader :segments
***************
*** 317,335 ****
      class SEGMENT
        def self.region(entry_id, start, stop)
! 	segment = self.new
! 	segment.entry_id = entry_id
! 	segment.start = start
! 	segment.stop = stop
! 	return segment
        end
  
        def initialize
! 	@features = Array.new		# for FEATURE
! 	@types = Array.new		# for TYPE
        end
        attr_accessor :entry_id, :start, :stop, :orientation, :description,
! 	:subparts,			# optional
! 	:features, :version, :label,	# for FEATURE
! 	:types				# for TYPE
      end
  
--- 317,335 ----
      class SEGMENT
        def self.region(entry_id, start, stop)
!         segment = self.new
!         segment.entry_id = entry_id
!         segment.start = start
!         segment.stop = stop
!         return segment
        end
  
        def initialize
!         @features = Array.new		# for FEATURE
!         @types = Array.new		# for TYPE
        end
        attr_accessor :entry_id, :start, :stop, :orientation, :description,
!         :subparts,			# optional
!         :features, :version, :label,	# for FEATURE
!         :types				# for TYPE
      end
  
***************
*** 346,355 ****
      class TYPE
        attr_accessor :entry_id, :method, :category, :count,
! 	:reference, :label	# for FEATURE
      end
  
      class GFF
        def initialize
! 	@segments = Array.new
        end
        attr_reader :segments
--- 346,355 ----
      class TYPE
        attr_accessor :entry_id, :method, :category, :count,
!         :reference, :label	# for FEATURE
      end
  
      class GFF
        def initialize
!         @segments = Array.new
        end
        attr_reader :segments
***************
*** 359,370 ****
      class FEATURE
        def initialize
! 	@notes = Array.new
! 	@links = Array.new
! 	@types = Array.new
! 	@targets = Array.new
! 	@groups = Array.new
        end
        attr_accessor :entry_id, :label,
! 	:method_id, :method, :start, :stop, :score, :orientation, :phase
        attr_reader :notes, :links, :types, :targets, :groups
      end
--- 359,370 ----
      class FEATURE
        def initialize
!         @notes = Array.new
!         @links = Array.new
!         @types = Array.new
!         @targets = Array.new
!         @groups = Array.new
        end
        attr_accessor :entry_id, :label,
!         :method_id, :method, :start, :stop, :score, :orientation, :phase
        attr_reader :notes, :links, :types, :targets, :groups
      end
***************
*** 380,386 ****
      class GROUP
        def initialize
! 	@notes = Array.new
! 	@links = Array.new
! 	@targets = Array.new
        end
        attr_accessor :entry_id, :label, :type
--- 380,386 ----
      class GROUP
        def initialize
!         @notes = Array.new
!         @links = Array.new
!         @targets = Array.new
        end
        attr_accessor :entry_id, :label, :type

Index: sql.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/sql.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sql.rb	25 Feb 2003 15:47:47 -0000	1.2
--- sql.rb	8 Sep 2005 01:22:12 -0000	1.3
***************
*** 58,68 ****
  
        def initialize(dbh, entry)
! 	@dbh = dbh
! 	@bioentry_id = entry['bioentry_id']
! 	@database_id = entry['biodatabase_id']
! 	@entry_id = entry['display_id']
! 	@accession = entry['accession']
! 	@version = entry['entry_version']
! 	@division = entry['division']
        end
        attr_reader :accession, :division, :entry_id, :version
--- 58,68 ----
  
        def initialize(dbh, entry)
!         @dbh = dbh
!         @bioentry_id = entry['bioentry_id']
!         @database_id = entry['biodatabase_id']
!         @entry_id = entry['display_id']
!         @accession = entry['accession']
!         @version = entry['entry_version']
!         @division = entry['division']
        end
        attr_reader :accession, :division, :entry_id, :version
***************
*** 70,243 ****
  
        def to_fasta
! 	if seq = seq
! 	  return seq.to_fasta(@accession)
! 	end
        end
  
        def seq
! 	query = "select * from biosequence where bioentry_id = ?"
! 	row = @dbh.execute(query, @bioentry_id).fetch
! 	return unless row
  
! 	mol = row['molecule']
! 	seq = row['biosequence_str']
  
! 	case mol
! 	when /.na/i			# 'dna' or 'rna'
! 	  Bio::Sequence::NA.new(seq)
! 	else				# 'protein'
! 	  Bio::Sequence::AA.new(seq)
! 	end
        end
  
        def subseq(from, to)
! 	length = to - from + 1
! 	query = "select molecule, substring(biosequence_str, ?, ?) as subseq" +
! 	        " from biosequence where bioentry_id = ?"
! 	row = @dbh.execute(query, from, length, @bioentry_id).fetch
! 	return unless row
  
! 	mol = row['molecule']
! 	seq = row['subseq']
  
! 	case mol
! 	when /.na/i			# 'dna' or 'rna'
! 	  Bio::Sequence::NA.new(seq)
! 	else				# 'protein'
! 	  Bio::Sequence::AA.new(seq)
! 	end
        end
  
  
        def features
! 	array = []
! 	query = "select * from seqfeature where bioentry_id = ?"
! 	@dbh.execute(query, @bioentry_id).fetch_all.each do |row|
! 	  next unless row
  
! 	  f_id = row['seqfeature_id']
! 	  k_id = row['seqfeature_key_id']
! 	  s_id = row['seqfeature_source_id']
! 	  rank = row['seqfeature_rank'].to_i - 1
  
! 	  # key : type (gene, CDS, ...)
! 	  type = feature_key(k_id)
  
! 	  # source : database (EMBL/GenBank/SwissProt)
! 	  database = feature_source(s_id)
  
! 	  # location : position
! 	  locations = feature_locations(f_id)
  
! 	  # qualifier
! 	  qualifiers = feature_qualifiers(f_id)
    
! 	  # rank
! 	  array[rank] = Bio::Feature.new(type, locations, qualifiers)
! 	end
! 	return Bio::Features.new(array)
        end
  
  
        def references
! 	array = []
! 	query = <<-END
! 	  select * from bioentry_reference, reference
! 	  where bioentry_id = ? and
! 	  bioentry_reference.reference_id = reference.reference_id
! 	END
! 	@dbh.execute(query, @bioentry_id).fetch_all.each do |row|
! 	  next unless row
  
! 	  hash = {
! 	    'start'	=> row['reference_start'],
! 	    'end'	=> row['reference_end'],
! 	    'journal'	=> row['reference_location'],
! 	    'title'	=> row['reference_title'],
! 	    'authors'	=> row['reference_authors'],
! 	    'medline'	=> row['reference_medline']
! 	  }
! 	  hash.default = ''
  
! 	  rank = row['reference_rank'].to_i - 1
! 	  array[rank] = hash
! 	end
! 	return array
        end
  
  
        def comment
! 	query = "select * from comment where bioentry_id = ?"
! 	row = @dbh.execute(query, @bioentry_id).fetch
! 	row ? row['comment_text'] : ''
        end
  
        def comments
! 	array = []
! 	query = "select * from comment where bioentry_id = ?"
! 	@dbh.execute(query, @bioentry_id).fetch_all.each do |row|
! 	  next unless row
! 	  rank = row['comment_rank'].to_i - 1
! 	  array[rank] = row['comment_text']
! 	end
! 	return array
        end
  
        def database
! 	query = "select * from biodatabase where biodatabase_id = ?"
! 	row = @dbh.execute(query, @database_id).fetch
! 	row ? row['name'] : ''
        end
  
        def date
! 	query = "select * from bioentry_date where bioentry_id = ?"
! 	row = @dbh.execute(query, @bioentry_id).fetch
! 	row ? row['date'] : ''
        end
  
        def dblink
! 	query = "select * from bioentry_direct_links where source_bioentry_id = ?"
! 	row = @dbh.execute(query, @bioentry_id).fetch
! 	row ? [row['dbname'], row['accession']] : []
        end
  
        def definition
! 	query = "select * from bioentry_description where bioentry_id = ?"
! 	row = @dbh.execute(query, @bioentry_id).fetch
! 	row ? row['description'] : ''
        end
  
        def keyword
! 	query = "select * from bioentry_keywords where bioentry_id = ?"
! 	row = @dbh.execute(query, @bioentry_id).fetch
! 	row ? row['keywords'] : ''
        end
  
        def taxonomy
! 	query = <<-END
! 	  select full_lineage, common_name, ncbi_taxa_id
! 	  from bioentry_taxa, taxa
! 	  where bioentry_id = ? and bioentry_taxa.taxa_id = taxa.taxa_id
! 	END
! 	row = @dbh.execute(query, @bioentry_id).fetch
! 	@lineage = row ? row['full_lineage'] : ''
! 	@common_name = row ? row['common_name'] : ''
! 	@ncbi_taxa_id = row ? row['ncbi_taxa_id'] : ''
! 	row ? [@lineage, @common_name, @ncbi_taxa_id] : []
        end
  
        def lineage
! 	taxonomy unless @lineage
! 	return @lineage
        end
  
        def common_name
! 	taxonomy unless @common_name
! 	return @common_name
        end
  
        def ncbi_taxa_id
! 	taxonomy unless @ncbi_taxa_id
! 	return @ncbi_taxa_id
        end
  
--- 70,243 ----
  
        def to_fasta
!         if seq = seq
!           return seq.to_fasta(@accession)
!         end
        end
  
        def seq
!         query = "select * from biosequence where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         return unless row
  
!         mol = row['molecule']
!         seq = row['biosequence_str']
  
!         case mol
!         when /.na/i			# 'dna' or 'rna'
!           Bio::Sequence::NA.new(seq)
!         else				# 'protein'
!           Bio::Sequence::AA.new(seq)
!         end
        end
  
        def subseq(from, to)
!         length = to - from + 1
!         query = "select molecule, substring(biosequence_str, ?, ?) as subseq" +
!                 " from biosequence where bioentry_id = ?"
!         row = @dbh.execute(query, from, length, @bioentry_id).fetch
!         return unless row
  
!         mol = row['molecule']
!         seq = row['subseq']
  
!         case mol
!         when /.na/i			# 'dna' or 'rna'
!           Bio::Sequence::NA.new(seq)
!         else				# 'protein'
!           Bio::Sequence::AA.new(seq)
!         end
        end
  
  
        def features
!         array = []
!         query = "select * from seqfeature where bioentry_id = ?"
!         @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!           next unless row
  
!           f_id = row['seqfeature_id']
!           k_id = row['seqfeature_key_id']
!           s_id = row['seqfeature_source_id']
!           rank = row['seqfeature_rank'].to_i - 1
  
!           # key : type (gene, CDS, ...)
!           type = feature_key(k_id)
  
!           # source : database (EMBL/GenBank/SwissProt)
!           database = feature_source(s_id)
  
!           # location : position
!           locations = feature_locations(f_id)
  
!           # qualifier
!           qualifiers = feature_qualifiers(f_id)
    
!           # rank
!           array[rank] = Bio::Feature.new(type, locations, qualifiers)
!         end
!         return Bio::Features.new(array)
        end
  
  
        def references
!         array = []
!         query = <<-END
!           select * from bioentry_reference, reference
!           where bioentry_id = ? and
!           bioentry_reference.reference_id = reference.reference_id
!         END
!         @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!           next unless row
  
!           hash = {
!             'start'	=> row['reference_start'],
!             'end'	=> row['reference_end'],
!             'journal'	=> row['reference_location'],
!             'title'	=> row['reference_title'],
!             'authors'	=> row['reference_authors'],
!             'medline'	=> row['reference_medline']
!           }
!           hash.default = ''
  
!           rank = row['reference_rank'].to_i - 1
!           array[rank] = hash
!         end
!         return array
        end
  
  
        def comment
!         query = "select * from comment where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? row['comment_text'] : ''
        end
  
        def comments
!         array = []
!         query = "select * from comment where bioentry_id = ?"
!         @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!           next unless row
!           rank = row['comment_rank'].to_i - 1
!           array[rank] = row['comment_text']
!         end
!         return array
        end
  
        def database
!         query = "select * from biodatabase where biodatabase_id = ?"
!         row = @dbh.execute(query, @database_id).fetch
!         row ? row['name'] : ''
        end
  
        def date
!         query = "select * from bioentry_date where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? row['date'] : ''
        end
  
        def dblink
!         query = "select * from bioentry_direct_links where source_bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? [row['dbname'], row['accession']] : []
        end
  
        def definition
!         query = "select * from bioentry_description where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? row['description'] : ''
        end
  
        def keyword
!         query = "select * from bioentry_keywords where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? row['keywords'] : ''
        end
  
        def taxonomy
!         query = <<-END
!           select full_lineage, common_name, ncbi_taxa_id
!           from bioentry_taxa, taxa
!           where bioentry_id = ? and bioentry_taxa.taxa_id = taxa.taxa_id
!         END
!         row = @dbh.execute(query, @bioentry_id).fetch
!         @lineage = row ? row['full_lineage'] : ''
!         @common_name = row ? row['common_name'] : ''
!         @ncbi_taxa_id = row ? row['ncbi_taxa_id'] : ''
!         row ? [@lineage, @common_name, @ncbi_taxa_id] : []
        end
  
        def lineage
!         taxonomy unless @lineage
!         return @lineage
        end
  
        def common_name
!         taxonomy unless @common_name
!         return @common_name
        end
  
        def ncbi_taxa_id
!         taxonomy unless @ncbi_taxa_id
!         return @ncbi_taxa_id
        end
  
***************
*** 246,315 ****
  
        def feature_key(k_id)
! 	query = "select * from seqfeature_key where seqfeature_key_id = ?"
! 	row = @dbh.execute(query, k_id).fetch
! 	row ? row['key_name'] : ''
        end
  
        def feature_source(s_id)
! 	query = "select * from seqfeature_source where seqfeature_source_id = ?"
! 	row = @dbh.execute(query, s_id).fetch
! 	row ? row['source_name'] : ''
        end
  
        def feature_locations(f_id)
! 	locations = []
! 	query = "select * from seqfeature_location where seqfeature_id = ?"
! 	@dbh.execute(query, f_id).fetch_all.each do |row|
! 	  next unless row
  
! 	  location = Bio::Location.new
! 	  location.strand = row['seq_strand']
! 	  location.from = row['seq_start']
! 	  location.to = row['seq_end']
  
! 	  xref = feature_locations_remote(row['seqfeature_location_id'])
! 	  location.xref_id = xref.shift unless xref.empty?
  
! 	  # just omit fuzzy location for now...
! 	  #feature_locations_qv(row['seqfeature_location_id'])
  
! 	  rank = row['location_rank'].to_i - 1
! 	  locations[rank] = location
! 	end
! 	return Bio::Locations.new(locations)
        end
  
        def feature_locations_remote(l_id)
! 	query = "select * from remote_seqfeature_name where seqfeature_location_id = ?"
! 	row = @dbh.execute(query, l_id).fetch
! 	row ? [row['accession'], row['version']] : []
        end
  
        def feature_locations_qv(l_id)
! 	query = "select * from location_qualifier_value where seqfeature_location_id = ?"
! 	row = @dbh.execute(query, l_id).fetch
! 	row ? [row['qualifier_value'], row['slot_value']] : []
        end
  
        def feature_qualifiers(f_id)
! 	qualifiers = []
! 	query = "select * from seqfeature_qualifier_value where seqfeature_id = ?"
! 	@dbh.execute(query, f_id).fetch_all.each do |row|
! 	  next unless row
  
! 	  key = feature_qualifiers_key(row['seqfeature_qualifier_id'])
! 	  value = row['qualifier_value']
! 	  qualifier = Bio::Feature::Qualifier.new(key, value)
  
! 	  rank = row['seqfeature_qualifier_rank'].to_i - 1
! 	  qualifiers[rank] = qualifier
! 	end
! 	return qualifiers.compact	# .compact is nasty hack for a while
        end
  
        def feature_qualifiers_key(q_id)
! 	query = "select * from seqfeature_qualifier where seqfeature_qualifier_id = ?"
! 	row = @dbh.execute(query, q_id).fetch
! 	row ? row['qualifier_name'] : ''
        end
      end
--- 246,315 ----
  
        def feature_key(k_id)
!         query = "select * from seqfeature_key where seqfeature_key_id = ?"
!         row = @dbh.execute(query, k_id).fetch
!         row ? row['key_name'] : ''
        end
  
        def feature_source(s_id)
!         query = "select * from seqfeature_source where seqfeature_source_id = ?"
!         row = @dbh.execute(query, s_id).fetch
!         row ? row['source_name'] : ''
        end
  
        def feature_locations(f_id)
!         locations = []
!         query = "select * from seqfeature_location where seqfeature_id = ?"
!         @dbh.execute(query, f_id).fetch_all.each do |row|
!           next unless row
  
!           location = Bio::Location.new
!           location.strand = row['seq_strand']
!           location.from = row['seq_start']
!           location.to = row['seq_end']
  
!           xref = feature_locations_remote(row['seqfeature_location_id'])
!           location.xref_id = xref.shift unless xref.empty?
  
!           # just omit fuzzy location for now...
!           #feature_locations_qv(row['seqfeature_location_id'])
  
!           rank = row['location_rank'].to_i - 1
!           locations[rank] = location
!         end
!         return Bio::Locations.new(locations)
        end
  
        def feature_locations_remote(l_id)
!         query = "select * from remote_seqfeature_name where seqfeature_location_id = ?"
!         row = @dbh.execute(query, l_id).fetch
!         row ? [row['accession'], row['version']] : []
        end
  
        def feature_locations_qv(l_id)
!         query = "select * from location_qualifier_value where seqfeature_location_id = ?"
!         row = @dbh.execute(query, l_id).fetch
!         row ? [row['qualifier_value'], row['slot_value']] : []
        end
  
        def feature_qualifiers(f_id)
!         qualifiers = []
!         query = "select * from seqfeature_qualifier_value where seqfeature_id = ?"
!         @dbh.execute(query, f_id).fetch_all.each do |row|
!           next unless row
  
!           key = feature_qualifiers_key(row['seqfeature_qualifier_id'])
!           value = row['qualifier_value']
!           qualifier = Bio::Feature::Qualifier.new(key, value)
  
!           rank = row['seqfeature_qualifier_rank'].to_i - 1
!           qualifiers[rank] = qualifier
!         end
!         return qualifiers.compact	# .compact is nasty hack for a while
        end
  
        def feature_qualifiers_key(q_id)
!         query = "select * from seqfeature_qualifier where seqfeature_qualifier_id = ?"
!         row = @dbh.execute(query, q_id).fetch
!         row ? row['qualifier_name'] : ''
        end
      end

Index: flatfile.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile.rb,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** flatfile.rb	10 Aug 2005 17:15:23 -0000	1.35
--- flatfile.rb	8 Sep 2005 01:22:11 -0000	1.36
***************
*** 31,35 ****
        openmode = []
        while x = arg[0] and !x.is_a?(Hash)
! 	openmode << arg.shift
        end
        # rest of arg: passed to FlatFile.new
--- 31,35 ----
        openmode = []
        while x = arg[0] and !x.is_a?(Hash)
!         openmode << arg.shift
        end
        # rest of arg: passed to FlatFile.new
***************
*** 78,84 ****
        # 1st arg: database class (or file format autodetection)
        if dbclass then
! 	self.dbclass = dbclass
        else
! 	autodetect
        end
      end
--- 78,84 ----
        # 1st arg: database class (or file format autodetection)
        if dbclass then
!         self.dbclass = dbclass
        else
!         autodetect
        end
      end
***************
*** 89,105 ****
        return nil unless @entry_raw
        if raw then
! 	@entry_raw
        else
! 	e = @dbclass.new(@entry_raw)
! 	begin
! 	  s = e.entry_overrun
! 	rescue NameError
! 	  s = nil
! 	end
! 	if s then
! 	  @entry_raw[-(s.length), s.length] = ''
! 	  ungets(s)
! 	end
! 	e
        end
      end
--- 89,105 ----
        return nil unless @entry_raw
        if raw then
!         @entry_raw
        else
!         e = @dbclass.new(@entry_raw)
!         begin
!           s = e.entry_overrun
!         rescue NameError
!           s = nil
!         end
!         if s then
!           @entry_raw[-(s.length), s.length] = ''
!           ungets(s)
!         end
!         e
        end
      end
***************
*** 108,112 ****
      def each_entry
        while e = self.next_entry
! 	yield e
        end
      end
--- 108,112 ----
      def each_entry
        while e = self.next_entry
!         yield e
        end
      end
***************
*** 135,141 ****
      def eof?
        if @prefetch.size > 0
! 	false
        else
! 	@io.eof?
        end
      end
--- 135,141 ----
      def eof?
        if @prefetch.size > 0
!         false
        else
!         @io.eof?
        end
      end
***************
*** 143,176 ****
      def gets(io_rs = $/)
        if @prefetch.size > 0
! 	if io_rs == nil then
! 	  r = @prefetch + @io.gets(nil).to_s
! 	  @prefetch = ''
! 	else
! 	  if io_rs == '' then
! 	    sp_rs = /\n\n/n
! 	    sp_rs_orig = "\n\n"
! 	  else
! 	    sp_rs = Regexp.new(Regexp.escape(io_rs, 'n'), 0, 'n')
! 	    sp_rs_orig = io_rs
! 	  end
! 	  a = @prefetch.split(sp_rs, 2)
! 	  if a.size > 1 then
! 	    r = a[0] + sp_rs_orig
! 	    @prefetch = a[1]
! 	  else
! 	    @prefetch << @io.gets(io_rs).to_s
! 	    a = @prefetch.split(sp_rs, 2)
! 	    if a.size > 1 then
! 	      r = a[0] + sp_rs_orig
! 	      @prefetch = a[1].to_s
! 	    else
! 	      r = @prefetch
! 	      @prefetch = ''
! 	    end
! 	  end
! 	end
! 	r
        else
! 	@io.gets(io_rs)
        end
      end
--- 143,176 ----
      def gets(io_rs = $/)
        if @prefetch.size > 0
!         if io_rs == nil then
!           r = @prefetch + @io.gets(nil).to_s
!           @prefetch = ''
!         else
!           if io_rs == '' then
!             sp_rs = /\n\n/n
!             sp_rs_orig = "\n\n"
!           else
!             sp_rs = Regexp.new(Regexp.escape(io_rs, 'n'), 0, 'n')
!             sp_rs_orig = io_rs
!           end
!           a = @prefetch.split(sp_rs, 2)
!           if a.size > 1 then
!             r = a[0] + sp_rs_orig
!             @prefetch = a[1]
!           else
!             @prefetch << @io.gets(io_rs).to_s
!             a = @prefetch.split(sp_rs, 2)
!             if a.size > 1 then
!               r = a[0] + sp_rs_orig
!               @prefetch = a[1].to_s
!             else
!               r = @prefetch
!               @prefetch = ''
!             end
!           end
!         end
!         r
        else
!         @io.gets(io_rs)
        end
      end
***************
*** 183,190 ****
      def getc
        if @prefetch.size > 0 then
! 	r = @prefetch[0]
! 	@prefetch = @prefetch[1..-1]
        else
! 	r = @io.getc
        end
        r
--- 183,190 ----
      def getc
        if @prefetch.size > 0 then
!         r = @prefetch[0]
!         @prefetch = @prefetch[1..-1]
        else
!         r = @io.getc
        end
        r
***************
*** 203,211 ****
      def dbclass=(k)
        if k then
! 	@dbclass = k
! 	@rs = @dbclass::DELIMITER
        else
! 	@dbclass = nil
! 	@rs = $/
        end
      end
--- 203,211 ----
      def dbclass=(k)
        if k then
!         @dbclass = k
!         @rs = @dbclass::DELIMITER
        else
!         @dbclass = nil
!         @rs = $/
        end
      end
***************
*** 216,229 ****
        r = nil
        1.upto(lines) do |x|
! 	if line = @io.gets then
! 	  @prefetch << line
! 	  if line and line.strip.size > 0 then
! 	    r = self.class.autodetect(@prefetch)
! 	    if r then
! 	      self.dbclass = r
! 	      return r
! 	    end
! 	  end
! 	end
        end
        self.dbclass = nil unless dbclass
--- 216,229 ----
        r = nil
        1.upto(lines) do |x|
!         if line = @io.gets then
!           @prefetch << line
!           if line and line.strip.size > 0 then
!             r = self.class.autodetect(@prefetch)
!             if r then
!               self.dbclass = r
!               return r
!             end
!           end
!         end
        end
        self.dbclass = nil unless dbclass
***************
*** 248,309 ****
        case text
        when /^LOCUS       .+ bp .*[a-z]*[DR]?NA/
! 	Bio::GenBank
        when /^LOCUS       .+ aa .+/
! 	Bio::GenPept
        when /^UI  \- [0-9]+$/
! 	Bio::MEDLINE
! 	
        when /^ID   .+\; *(DNA|RNA|XXX)\;/
! 	Bio::EMBL
        when /^ID   .+\; *PRT\;/
! 	Bio::SPTR
        when /^ID   [-A-Za-z0-9_\.]+\; (PATTERN|RULE|MATRIX)\.$/
! 	Bio::PROSITE
        when /^AC  [-A-Za-z0-9_\.]+$/
! 	Bio::TRANSFAC
  
        when /^H [-A-Z0-9_\.]+$/
! 	if text =~ /^M [rc]/ then
! 	  Bio::AAindex2
! 	elsif text =~ /^I    A\/L/ then
! 	  Bio::AAindex1
! 	else
! 	  false #fail to determine
! 	end
  
        when /^CODE        [0-9]+$/
! 	Bio::LITDB
        when /^Entry           [A-Z0-9]+/
! 	Bio::KEGG::BRITE
! 	
        when /^ENTRY       .+ KO\s*$/
! 	Bio::KEGG::KO
        when /^ENTRY       .+ Glycan\s*$/
          Bio::KEGG::GLYCAN
        when /^ENTRY       .+ (CDS|gene|.*RNA) /
! 	Bio::KEGG::GENES
        when /^ENTRY       EC [0-9\.]+$/
! 	Bio::KEGG::ENZYME
        when /^ENTRY       C[A-Za-z0-9\._]+$/
! 	Bio::KEGG::COMPOUND
        when /^ENTRY       R[A-Za-z0-9\._]+$/
! 	Bio::KEGG::REACTION
        when /^ENTRY       [a-z]+$/
! 	Bio::KEGG::GENOME
  
        when /\<\!DOCTYPE\s+maxml\-(sequences|clusters)\s+SYSTEM/
! 	if $1 == 'clusters'
! 	  Bio::FANTOM::MaXML::Cluster
! 	elsif $1 == 'sequences'
! 	  Bio::FANTOM::MaXML::Sequence
! 	else
! 	  nil #unknown
! 	end
  
        when /^HEADER    .{40}\d\d\-[A-Z]{3}\-\d\d   [0-9A-Z]{4}/
! 	Bio::PDB
  
        when /^CLUSTAL .*\(.*\).*sequence +alignment/
! 	Bio::ClustalW::Report
  
        when /\<\!DOCTYPE BlastOutput PUBLIC /
--- 248,309 ----
        case text
        when /^LOCUS       .+ bp .*[a-z]*[DR]?NA/
!         Bio::GenBank
        when /^LOCUS       .+ aa .+/
!         Bio::GenPept
        when /^UI  \- [0-9]+$/
!         Bio::MEDLINE
!         
        when /^ID   .+\; *(DNA|RNA|XXX)\;/
!         Bio::EMBL
        when /^ID   .+\; *PRT\;/
!         Bio::SPTR
        when /^ID   [-A-Za-z0-9_\.]+\; (PATTERN|RULE|MATRIX)\.$/
!         Bio::PROSITE
        when /^AC  [-A-Za-z0-9_\.]+$/
!         Bio::TRANSFAC
  
        when /^H [-A-Z0-9_\.]+$/
!         if text =~ /^M [rc]/ then
!           Bio::AAindex2
!         elsif text =~ /^I    A\/L/ then
!           Bio::AAindex1
!         else
!           false #fail to determine
!         end
  
        when /^CODE        [0-9]+$/
!         Bio::LITDB
        when /^Entry           [A-Z0-9]+/
!         Bio::KEGG::BRITE
!         
        when /^ENTRY       .+ KO\s*$/
!         Bio::KEGG::KO
        when /^ENTRY       .+ Glycan\s*$/
          Bio::KEGG::GLYCAN
        when /^ENTRY       .+ (CDS|gene|.*RNA) /
!         Bio::KEGG::GENES
        when /^ENTRY       EC [0-9\.]+$/
!         Bio::KEGG::ENZYME
        when /^ENTRY       C[A-Za-z0-9\._]+$/
!         Bio::KEGG::COMPOUND
        when /^ENTRY       R[A-Za-z0-9\._]+$/
!         Bio::KEGG::REACTION
        when /^ENTRY       [a-z]+$/
!         Bio::KEGG::GENOME
  
        when /\<\!DOCTYPE\s+maxml\-(sequences|clusters)\s+SYSTEM/
!         if $1 == 'clusters'
!           Bio::FANTOM::MaXML::Cluster
!         elsif $1 == 'sequences'
!           Bio::FANTOM::MaXML::Sequence
!         else
!           nil #unknown
!         end
  
        when /^HEADER    .{40}\d\d\-[A-Z]{3}\-\d\d   [0-9A-Z]{4}/
!         Bio::PDB
  
        when /^CLUSTAL .*\(.*\).*sequence +alignment/
!         Bio::ClustalW::Report
  
        when /\<\!DOCTYPE BlastOutput PUBLIC /
***************
*** 311,327 ****
  
        when /^BLAST.? +[\-\.\w]+\-WashU +\[[\-\.\w ]+\]/
! 	Bio::Blast::WU::Report
        when /^TBLAST.? +[\-\.\w]+\-WashU +\[[\-\.\w ]+\]/
! 	Bio::Blast::WU::Report_TBlast
  
        when /^BLAST.? +[\-\.\w]+ +\[[\-\.\w ]+\]/
! 	Bio::Blast::Default::Report
        when /^TBLAST.? +[\-\.\w]+ +\[[\-\.\w ]+\]/
! 	Bio::Blast::Default::Report_TBlast
  
        when /^psLayout version \d+\s*$/
          Bio::Blat::Report
        when /^\-\-SPIDEY version .+\-\-$/
! 	Bio::Spidey::Report
  
        when /^seq1 \= .*\, \d+ bp(\r|\r?\n)seq2 \= .*\, \d+ bp(\r|\r?\n)/
--- 311,327 ----
  
        when /^BLAST.? +[\-\.\w]+\-WashU +\[[\-\.\w ]+\]/
!         Bio::Blast::WU::Report
        when /^TBLAST.? +[\-\.\w]+\-WashU +\[[\-\.\w ]+\]/
!         Bio::Blast::WU::Report_TBlast
  
        when /^BLAST.? +[\-\.\w]+ +\[[\-\.\w ]+\]/
!         Bio::Blast::Default::Report
        when /^TBLAST.? +[\-\.\w]+ +\[[\-\.\w ]+\]/
!         Bio::Blast::Default::Report_TBlast
  
        when /^psLayout version \d+\s*$/
          Bio::Blat::Report
        when /^\-\-SPIDEY version .+\-\-$/
!         Bio::Spidey::Report
  
        when /^seq1 \= .*\, \d+ bp(\r|\r?\n)seq2 \= .*\, \d+ bp(\r|\r?\n)/
***************
*** 329,344 ****
  
        when /^>.+$/
! 	if text =~ /^>([PF]1|[DR][LC]|N[13]|XX)\;.+/ then
! 	  Bio::NBRF
! 	elsif text =~ /^>.+$\s+(^\#.*$\s*)*^\s*\d*\s*[-a-zA-Z_\.\[\]\(\)\*\+\$]+/ then
! 	  Bio::FastaFormat
! 	elsif text =~ /^>.+$\s+^\s*\d+(\s+\d+)*\s*$/ then
! 	  Bio::FastaNumericFormat
! 	else
! 	  false #fail to determine
! 	end
  
        else
! 	nil #not found
        end
      end
--- 329,344 ----
  
        when /^>.+$/
!         if text =~ /^>([PF]1|[DR][LC]|N[13]|XX)\;.+/ then
!           Bio::NBRF
!         elsif text =~ /^>.+$\s+(^\#.*$\s*)*^\s*\d*\s*[-a-zA-Z_\.\[\]\(\)\*\+\$]+/ then
!           Bio::FastaFormat
!         elsif text =~ /^>.+$\s+^\s*\d+(\s+\d+)*\s*$/ then
!           Bio::FastaNumericFormat
!         else
!           false #fail to determine
!         end
  
        else
!         nil #not found
        end
      end



More information about the bioruby-cvs mailing list