GET xrefs/id/:id

Perform lookups of identifiers and retrieve their external references in other databases

Parameters

Required

NameTypeDescriptionDefaultExample Values
id String A Stable ID - ENSG00000157764

Optional

NameTypeDescriptionDefaultExample Values
all_levels Boolean Set to find all genetic features linked to the stable ID, and fetch all external references for them. Specifying this on a gene will also return values from its transcripts and translations 0 1
callback String Name of the callback subroutine to be returned by the requested JSONP response. Required ONLY when using JSONP as the serialisation method. Please see the user guide. - randomlygeneratedname
db_type String Restrict the search to a database other than the default. Useful if you need to use a DB other than core core core
external_db String Filter by external database - EntrezGene
object_type String Filter by feature type - gene
transcript
species String Species name/alias - brugia_malayi_prjna10729

Example Requests

/rest-19/xrefs/id/WBGene00221255?content-type=application/json


 [
  {
    "info_type": "DEPENDENT",
    "primary_id": "6095652",
    "db_display_name": "WikiGene",
    "version": "0",
    "synonyms": [],
    "description": "WH2 motif family protein",
    "dbname": "WikiGene",
    "display_id": "Bm994",
    "info_text": ""
  },
  {
    "db_display_name": "WormBase Gene",
    "info_type": "DIRECT",
    "primary_id": "WBGene00221255",
    "display_id": "WBGene00221255",
    "dbname": "wormbase_gene",
    "info_text": "",
    "version": "0",
    "description": null,
    "synonyms": []
  },
  {
    "db_display_name": "WormBase Gene Sequence-name",
    "primary_id": "WBGene00221255",
    "info_type": "DIRECT",
    "info_text": "",
    "display_id": "Bm994",
    "dbname": "wormbase_gseqname",
    "description": null,
    "synonyms": [],
    "version": "0"
  },
  {
    "synonyms": [
      "Bm1_03535"
    ],
    "description": "WH2 motif family protein",
    "version": "0",
    "info_text": "",
    "display_id": "Bm994",
    "dbname": "EntrezGene",
    "db_display_name": "NCBI gene (formerly Entrezgene)",
    "primary_id": "6095652",
    "info_type": "DEPENDENT"
  }
]
  1. use strict;
  2. use warnings;
  3.  
  4. use HTTP::Tiny;
  5.  
  6. my $http = HTTP::Tiny->new();
  7.  
  8. my $server = 'https://parasite.wormbase.org';
  9. my $ext = '/rest-19/xrefs/id/WBGene00221255?';
  10. my $response = $http->get($server.$ext, {
  11. headers => { 'Content-type' => 'application/json' }
  12. });
  13.  
  14. die "Failed!\n" unless $response->{success};
  15.  
  16.  
  17. use JSON;
  18. use Data::Dumper;
  19. if(length $response->{content}) {
  20. my $hash = decode_json($response->{content});
  21. local $Data::Dumper::Terse = 1;
  22. local $Data::Dumper::Indent = 1;
  23. print Dumper $hash;
  24. print "\n";
  25. }
  26.  
  1. import requests, sys
  2.  
  3. server = "https://parasite.wormbase.org"
  4. ext = "/rest-19/xrefs/id/WBGene00221255?"
  5.  
  6. r = requests.get(server+ext, headers={ "Content-Type" : "application/json", "Accept" : ""})
  7.  
  8. if not r.ok:
  9. r.raise_for_status()
  10. sys.exit()
  11.  
  12. decoded = r.json()
  13. print repr(decoded)
  14.  
  1. import requests, sys
  2.  
  3. server = "https://parasite.wormbase.org"
  4. ext = "/rest-19/xrefs/id/WBGene00221255?"
  5.  
  6. r = requests.get(server+ext, headers={ "Content-Type" : "application/json", "Accept" : ""})
  7.  
  8. if not r.ok:
  9. r.raise_for_status()
  10. sys.exit()
  11.  
  12. decoded = r.json()
  13. print(repr(decoded))
  14.  
  1. require 'net/http'
  2. require 'uri'
  3.  
  4. server='https://parasite.wormbase.org'
  5. path = '/rest-19/xrefs/id/WBGene00221255?'
  6.  
  7. url = URI.parse(server)
  8. http = Net::HTTP.new(url.host, url.port)
  9.  
  10. request = Net::HTTP::Get.new(path, {'Content-Type' => 'application/json'})
  11.  
  12. response = http.request(request)
  13.  
  14. if response.code != "200"
  15. puts "Invalid response: #{response.code}"
  16. puts response.body
  17. exit
  18. end
  19.  
  20.  
  21. require 'rubygems'
  22. require 'json'
  23. require 'yaml'
  24.  
  25. result = JSON.parse(response.body)
  26. puts YAML::dump(result)
  27.  
  1. import java.net.URL;
  2. import java.net.URLConnection;
  3. import java.net.HttpURLConnection;
  4. import java.io.BufferedReader;
  5. import java.io.InputStream;
  6. import java.io.InputStreamReader;
  7. import java.io.IOException;
  8. import java.io.Reader;
  9.  
  10.  
  11. public class EnsemblRest {
  12.  
  13. public static void main(String[] args) throws Exception {
  14. String server = "https://parasite.wormbase.org";
  15. String ext = "/rest-19/xrefs/id/WBGene00221255?";
  16. URL url = new URL(server + ext);
  17.  
  18. URLConnection connection = url.openConnection();
  19. HttpURLConnection httpConnection = (HttpURLConnection)connection;
  20. httpConnection.setRequestProperty("Content-Type", "application/json");
  21.  
  22. InputStream response = connection.getInputStream();
  23. int responseCode = httpConnection.getResponseCode();
  24.  
  25. if(responseCode != 200) {
  26. throw new RuntimeException("Response code was not 200. Detected response was "+responseCode);
  27. }
  28.  
  29. String output;
  30. Reader reader = null;
  31. try {
  32. reader = new BufferedReader(new InputStreamReader(response, "UTF-8"));
  33. StringBuilder builder = new StringBuilder();
  34. char[] buffer = new char[8192];
  35. int read;
  36. while ((read = reader.read(buffer, 0, buffer.length)) > 0) {
  37. builder.append(buffer, 0, read);
  38. }
  39. output = builder.toString();
  40. }
  41. finally {
  42. if (reader != null) try {
  43. reader.close();
  44. } catch (IOException logOrIgnore) {
  45. logOrIgnore.printStackTrace();
  46. }
  47. }
  48.  
  49. System.out.println(output);
  50. }
  51. }
  52.  
  1.  
  2. curl 'https://parasite.wormbase.org/rest-19/xrefs/id/WBGene00221255?' -H 'Content-type:application/json'
  3.  
  1. wget -q --header='Content-type:application/json' 'https://parasite.wormbase.org/rest-19/xrefs/id/WBGene00221255?' -O -
  2.  

/rest-19/xrefs/id/Bm4789.1?all_levels=1;content-type=application/json;object_type=transcript;external_db=GO


 [
  {
    "db_display_name": "GO",
    "info_type": "DEPENDENT",
    "primary_id": "GO:0005886",
    "info_text": "",
    "display_id": "GO:0005886",
    "linkage_types": [
      "IEA"
    ],
    "dbname": "GO",
    "description": "plasma membrane",
    "synonyms": [],
    "version": "0"
  },
  {
    "version": "0",
    "synonyms": [],
    "description": "plasma membrane",
    "linkage_types": [
      "IEA"
    ],
    "display_id": "GO:0005886",
    "dbname": "GO",
    "info_text": "InterPro",
    "db_display_name": "GO",
    "info_type": "DIRECT",
    "primary_id": "GO:0005886"
  },
  {
    "info_text": "EnsemblMetazoa",
    "dbname": "GO",
    "linkage_types": [
      "IEA"
    ],
    "display_id": "GO:0009410",
    "description": "response to xenobiotic stimulus",
    "synonyms": [],
    "version": "0",
    "primary_id": "GO:0009410",
    "info_type": "DIRECT",
    "db_display_name": "GO"
  },
  {
    "db_display_name": "GO",
    "info_type": "DIRECT",
    "primary_id": "GO:0016020",
    "description": "membrane",
    "synonyms": [],
    "version": "0",
    "info_text": "UniProt",
    "linkage_types": [
      "IEA"
    ],
    "display_id": "GO:0016020",
    "dbname": "GO"
  },
  {
    "version": "0",
    "synonyms": [],
    "description": "membrane",
    "display_id": "GO:0016020",
    "linkage_types": [
      "IEA"
    ],
    "dbname": "GO",
    "info_text": "InterPro",
    "db_display_name": "GO",
    "primary_id": "GO:0016020",
    "info_type": "DIRECT"
  },
  {
    "db_display_name": "GO",
    "info_type": "DEPENDENT",
    "primary_id": "GO:0016020",
    "display_id": "GO:0016020",
    "linkage_types": [
      "IEA"
    ],
    "dbname": "GO",
    "info_text": "",
    "version": "0",
    "synonyms": [],
    "description": "membrane"
  },
  {
    "primary_id": "GO:0030424",
    "info_type": "DIRECT",
    "db_display_name": "GO",
    "synonyms": [],
    "description": "axon",
    "version": "0",
    "info_text": "EnsemblMetazoa",
    "dbname": "GO",
    "display_id": "GO:0030424",
    "linkage_types": [
      "IEA"
    ]
  }
]
  1. use strict;
  2. use warnings;
  3.  
  4. use HTTP::Tiny;
  5.  
  6. my $http = HTTP::Tiny->new();
  7.  
  8. my $server = 'https://parasite.wormbase.org';
  9. my $ext = '/rest-19/xrefs/id/Bm4789.1?external_db=GO;object_type=transcript;all_levels=1';
  10. my $response = $http->get($server.$ext, {
  11. headers => { 'Content-type' => 'application/json' }
  12. });
  13.  
  14. die "Failed!\n" unless $response->{success};
  15.  
  16.  
  17. use JSON;
  18. use Data::Dumper;
  19. if(length $response->{content}) {
  20. my $hash = decode_json($response->{content});
  21. local $Data::Dumper::Terse = 1;
  22. local $Data::Dumper::Indent = 1;
  23. print Dumper $hash;
  24. print "\n";
  25. }
  26.  
  1. import requests, sys
  2.  
  3. server = "https://parasite.wormbase.org"
  4. ext = "/rest-19/xrefs/id/Bm4789.1?external_db=GO;object_type=transcript;all_levels=1"
  5.  
  6. r = requests.get(server+ext, headers={ "Content-Type" : "application/json", "Accept" : ""})
  7.  
  8. if not r.ok:
  9. r.raise_for_status()
  10. sys.exit()
  11.  
  12. decoded = r.json()
  13. print repr(decoded)
  14.  
  1. import requests, sys
  2.  
  3. server = "https://parasite.wormbase.org"
  4. ext = "/rest-19/xrefs/id/Bm4789.1?external_db=GO;object_type=transcript;all_levels=1"
  5.  
  6. r = requests.get(server+ext, headers={ "Content-Type" : "application/json", "Accept" : ""})
  7.  
  8. if not r.ok:
  9. r.raise_for_status()
  10. sys.exit()
  11.  
  12. decoded = r.json()
  13. print(repr(decoded))
  14.  
  1. require 'net/http'
  2. require 'uri'
  3.  
  4. server='https://parasite.wormbase.org'
  5. path = '/rest-19/xrefs/id/Bm4789.1?external_db=GO;object_type=transcript;all_levels=1'
  6.  
  7. url = URI.parse(server)
  8. http = Net::HTTP.new(url.host, url.port)
  9.  
  10. request = Net::HTTP::Get.new(path, {'Content-Type' => 'application/json'})
  11.  
  12. response = http.request(request)
  13.  
  14. if response.code != "200"
  15. puts "Invalid response: #{response.code}"
  16. puts response.body
  17. exit
  18. end
  19.  
  20.  
  21. require 'rubygems'
  22. require 'json'
  23. require 'yaml'
  24.  
  25. result = JSON.parse(response.body)
  26. puts YAML::dump(result)
  27.  
  1. import java.net.URL;
  2. import java.net.URLConnection;
  3. import java.net.HttpURLConnection;
  4. import java.io.BufferedReader;
  5. import java.io.InputStream;
  6. import java.io.InputStreamReader;
  7. import java.io.IOException;
  8. import java.io.Reader;
  9.  
  10.  
  11. public class EnsemblRest {
  12.  
  13. public static void main(String[] args) throws Exception {
  14. String server = "https://parasite.wormbase.org";
  15. String ext = "/rest-19/xrefs/id/Bm4789.1?external_db=GO;object_type=transcript;all_levels=1";
  16. URL url = new URL(server + ext);
  17.  
  18. URLConnection connection = url.openConnection();
  19. HttpURLConnection httpConnection = (HttpURLConnection)connection;
  20. httpConnection.setRequestProperty("Content-Type", "application/json");
  21.  
  22. InputStream response = connection.getInputStream();
  23. int responseCode = httpConnection.getResponseCode();
  24.  
  25. if(responseCode != 200) {
  26. throw new RuntimeException("Response code was not 200. Detected response was "+responseCode);
  27. }
  28.  
  29. String output;
  30. Reader reader = null;
  31. try {
  32. reader = new BufferedReader(new InputStreamReader(response, "UTF-8"));
  33. StringBuilder builder = new StringBuilder();
  34. char[] buffer = new char[8192];
  35. int read;
  36. while ((read = reader.read(buffer, 0, buffer.length)) > 0) {
  37. builder.append(buffer, 0, read);
  38. }
  39. output = builder.toString();
  40. }
  41. finally {
  42. if (reader != null) try {
  43. reader.close();
  44. } catch (IOException logOrIgnore) {
  45. logOrIgnore.printStackTrace();
  46. }
  47. }
  48.  
  49. System.out.println(output);
  50. }
  51. }
  52.  
  1.  
  2. curl 'https://parasite.wormbase.org/rest-19/xrefs/id/Bm4789.1?external_db=GO;object_type=transcript;all_levels=1' -H 'Content-type:application/json'
  3.  
  1. wget -q --header='Content-type:application/json' 'https://parasite.wormbase.org/rest-19/xrefs/id/Bm4789.1?external_db=GO;object_type=transcript;all_levels=1' -O -
  2.  

Resource Information

MethodsGET
Response formatsjson
xml
jsonp