Module: Exodb::Ensembl::REST
- Defined in:
- lib/exodb/utils/ensemblrest.rb
Constant Summary collapse
- @@url =
URI.parse('http://rest.ensembl.org')
- @@http =
Net::HTTP.new(@@url.host, @@url.port)
Class Method Summary collapse
-
.assembly_map(region, asm_two, asm_one = Exodb::DEFAULTASSEMBLY, species = 'human', options = {}) ⇒ Object
Converse coordinate from one asembly to another from rest.ensembl.org/documentation/info/assembly_map.
- .get(get_path, options) ⇒ Object
-
.sequence_region(region, species, options = {}) ⇒ Object
Returns the genomic sequence of the specified region of the given species.
- .vep_hgvs_get(hgvs, species, options = {}) ⇒ Object
- .vep_region_get(region, allele, species, options = {}) ⇒ Object
Class Method Details
.assembly_map(region, asm_two, asm_one = Exodb::DEFAULTASSEMBLY, species = 'human', options = {}) ⇒ Object
Converse coordinate from one asembly to another from rest.ensembl.org/documentation/info/assembly_map
51 52 53 |
# File 'lib/exodb/utils/ensemblrest.rb', line 51 def assembly_map(region, asm_two, asm_one = Exodb::DEFAULTASSEMBLY, species = 'human', = {}) return Exodb::Ensembl::REST.get("map/#{species.gsub(/\s+/, '_')}/#{Exodb::ASSEMBLY[asm_one.downcase]}/#{region}/#{Exodb::ASSEMBLY[asm_two.downcase]}", ) end |
.get(get_path, options) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/exodb/utils/ensemblrest.rb', line 22 def get(get_path, ) request = Net::HTTP::Get.new(get_path, {'Content-Type' => 'application/json'}.merge()) response = @@http.request(request) if response.code != "200" riase InvalidResponse, "Invalid response: #{response.code}" else return JSON.parse(response.body) end end |
.sequence_region(region, species, options = {}) ⇒ Object
Returns the genomic sequence of the specified region of the given species. from rest.ensembl.org/documentation/info/sequence_region
61 62 63 |
# File 'lib/exodb/utils/ensemblrest.rb', line 61 def sequence_region(region, species, = {}) return Exodb::Ensembl::REST.get("sequence/region/#{species}/#{region}", {'Content-Type' => 'text/x-fasta', 'coord_system_version' => Exodb::DEFAULTASSEMBLY}.merge()) end |
.vep_hgvs_get(hgvs, species, options = {}) ⇒ Object
39 40 41 |
# File 'lib/exodb/utils/ensemblrest.rb', line 39 def vep_hgvs_get(hgvs, species, = {}) return Exodb::Ensembl::REST.get("vep/#{species}/hgvs/#{region}/allele", ) end |