| Class | Bio::Registry |
| In: |
lib/bio/io/registry.rb
|
| Parent: | Object |
| databases | [R] | List of databases (Array of Bio::Registry::DB) |
| spec_version | [R] | Version string of the first configulation file |
# File lib/bio/io/registry.rb, line 99
99: def initialize(file = nil)
100: @spec_version = nil
101: @databases = Array.new
102: read_local(file) if file
103: env_path = ENV['OBDA_SEARCH_PATH']
104: if env_path and env_path.size > 0
105: read_env(env_path)
106: else
107: read_local("#{ENV['HOME']}/.bioinformatics/seqdatabase.ini")
108: read_local("/etc/bioinformatics/seqdatabase.ini")
109: if @databases.empty?
110: read_remote("http://www.open-bio.org/registry/seqdatabase.ini")
111: end
112: end
113: end
Returns a dababase handle (Bio::SQL, Bio::Fetch etc.) or nil if not found (case insensitive). The handles should have get_by_id method.
# File lib/bio/io/registry.rb, line 124
124: def get_database(dbname)
125: @databases.each do |db|
126: if db.database == dbname.downcase
127: case db.protocol
128: when 'biofetch'
129: return serv_biofetch(db)
130: when 'biosql'
131: return serv_biosql(db)
132: when 'flat', 'index-flat', 'index-berkeleydb'
133: return serv_flat(db)
134: when 'bsane-corba', 'biocorba'
135: raise NotImplementedError
136: when 'xembl'
137: raise NotImplementedError
138: end
139: end
140: end
141: return nil
142: end
Returns a Registry::DB object corresponding to the first dbname entry in the registry records (case insensitive).
# File lib/bio/io/registry.rb, line 147
147: def query(dbname)
148: @databases.each do |db|
149: return db if db.database == dbname.downcase
150: end
151: end