Method: Bio::Registry#get_database

Defined in:
lib/bio/io/registry.rb

#get_database(dbname) ⇒ Object Also known as: db

Returns a dababase handle (Bio::SQL, Bio::Fetch etc.) or nil if not found (case insensitive). The handles should have get_by_id method.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/bio/io/registry.rb', line 124

def get_database(dbname)
  @databases.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
end