Module: EnsemblRest::CrossReference

Defined in:
lib/bio-ensembl-rest/cross-reference.rb

Class Method Summary collapse

Class Method Details

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

Perform lookups of Ensembl Identifiers and retrieve their external cross references in other databases



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bio-ensembl-rest/cross-reference.rb', line 7

def self.xrefs_id(id, opts = {})
  opts = EnsemblRest.parse_options opts
  path = EnsemblRest.build_path "/xrefs/id/#{id}", opts

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

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

.xrefs_name(species, name, opts = {}) ⇒ Object

Performs a lookup based upon the primary accession or display label of an external reference and returning the information we hold about the entry



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bio-ensembl-rest/cross-reference.rb', line 24

def self.xrefs_name(species, name, opts = {})
  opts = EnsemblRest.parse_options opts
  path = EnsemblRest.build_path "/xrefs/name/#{species}/#{name}", opts

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

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

.xrefs_symbol(species, symbol, opts = {}) ⇒ Object

Looks up an external symbol and returns all Ensembl objects linked to it



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bio-ensembl-rest/cross-reference.rb', line 40

def self.xrefs_symbol(species, symbol, opts = {})
  opts = EnsemblRest.parse_options opts
  path = EnsemblRest.build_path "/xrefs/symbol/#{species}/#{symbol}", opts

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

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