Class: Ensembl::Core::Collection
- Inherits:
-
Object
- Object
- Ensembl::Core::Collection
- Defined in:
- lib/bio-ensembl/core/collection.rb
Overview
Class to describe and handle multi-species databases
Class Method Summary collapse
-
.check ⇒ Boolean
Method to check if the current core database is a multi-species db.
-
.find_all_coord_by_table_name(table_name, species_id) ⇒ Array<Integer>
Returns an array with all the coord_system_id associated with a particular species and a table_name.
-
.get_species_id(species) ⇒ Integer
Returns the species_id of a particular species present in the database.
-
.species ⇒ Array<String>
Returns an array with all the Species present in a collection database.
Class Method Details
.check ⇒ Boolean
Method to check if the current core database is a multi-species db. Returns a boolean value.
20 21 22 23 24 25 26 |
# File 'lib/bio-ensembl/core/collection.rb', line 20 def self.check() host,user,password,db_name,port = Ensembl::Core::DBConnection.get_info if db_name =~/(\w+)_collection_core_.*/ return true end return false end |
.find_all_coord_by_table_name(table_name, species_id) ⇒ Array<Integer>
Returns an array with all the coord_system_id associated with a particular species and a table_name. Used inside Slice#method_missing to filter the coord_system_id using a particular species_id.
55 56 57 58 |
# File 'lib/bio-ensembl/core/collection.rb', line 55 def self.find_all_coord_by_table_name(table_name,species_id) all_ids = CoordSystem.find_all_by_species_id(species_id) return MetaCoord.find_all_by_coord_system_id_and_table_name(all_ids,table_name) end |
.get_species_id(species) ⇒ Integer
Returns the species_id of a particular species present in the database.
39 40 41 42 43 44 45 46 47 |
# File 'lib/bio-ensembl/core/collection.rb', line 39 def self.get_species_id(species) species = species.downcase = Meta.find_by_sql("SELECT * FROM meta WHERE LOWER(meta_value) = '#{species}'")[0] if .nil? return nil else return .species_id end end |
.species ⇒ Array<String>
Returns an array with all the Species present in a collection database.
31 32 33 |
# File 'lib/bio-ensembl/core/collection.rb', line 31 def self.species() return Meta.("species.db_name").collect {|m| m.} end |