Module: EnsemblRest::Taxonomy

Defined in:
lib/bio-ensembl-rest/taxonomy.rb

Class Method Summary collapse

Class Method Details

._taxonomy_generic(id, type, opts = {}) ⇒ Object

:nodoc:



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bio-ensembl-rest/taxonomy.rb', line 16

def self._taxonomy_generic(id, type, opts = {}) # :nodoc:
  opts = EnsemblRest.parse_options opts
  path = EnsemblRest.build_path "/taxonomy/#{type}/#{id}", opts

  if opts['content-type'] == 'ruby'
    plain_opts = opts.clone
    plain_opts['content-type'] = 'application/json'
    return JSON.parse _taxonomy_generic id, type, plain_opts
  end

  return EnsemblRest.fetch_data path, opts, 'taxonomy'
end

.taxonomy_classification(id, opts = {}) ⇒ Object

Return the taxonomic classification of a taxon node



12
13
14
# File 'lib/bio-ensembl-rest/taxonomy.rb', line 12

def self.taxonomy_classification(id, opts = {})
  return _taxonomy_generic id, 'classification', opts
end

.taxonomy_id(id, opts = {}) ⇒ Object

Search for a taxonomic term by its identifier or name



6
7
8
# File 'lib/bio-ensembl-rest/taxonomy.rb', line 6

def self.taxonomy_id(id, opts = {})
  return _taxonomy_generic id, 'id', opts
end