Method: Ensembl::Core::Slice.fetch_all
- Defined in:
- lib/bio-ensembl/core/slice.rb
.fetch_all(coord_system_name = 'chromosome', species = Ensembl::SESSION.collection_species, version = nil) ⇒ Array<Slice>
Create an array of all Slices for a given coordinate system.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/bio-ensembl/core/slice.rb', line 152 def self.fetch_all(coord_system_name = 'chromosome',species = Ensembl::SESSION.collection_species ,version = nil) answer = Array.new coord_system = nil if Collection.check species = species.downcase species_id = Collection.get_species_id(species) raise ArgumentError, "No specie found in the database with this name: #{species}" if species_id.nil? if version.nil? coord_system = Ensembl::Core::CoordSystem.find_by_name_and_species_id(coord_system_name,species_id) else coord_system = Ensembl::Core::CoordSystem.find_by_name_and_species_id_and_version(coord_system_name, species_id, version) end else if version.nil? coord_system = Ensembl::Core::CoordSystem.find_by_name(coord_system_name) else coord_system = Ensembl::Core::CoordSystem.find_by_name_and_version(coord_system_name, version) end end coord_system.seq_regions.each do |seq_region| answer.push(Ensembl::Core::Slice.new(seq_region)) end return answer end |