Tutorial:Open Targets and programmatic access
Entering edit mode
7.4 years ago
Denise CS ★ 5.2k

If you are working in disease biology, drug discovery and/or target identification, the chances are you have seen our previous post on the Open Targets project.

Perhaps you have even used our Open Targets Platform to search for target-disease associations on a gene by gene (or disease by disease) basis.

But if you are a bioinformatician working in disease biology, drug discovery and/or drug validation, the chances are you want to access and retrieve data on several genes or several diseases. All at the same time. To do this, you would access Open Targets in a programmatic way, wouldn’t you?

Our public REST (REpresentation State Transfer) API is what you would be looking for. Easy access to our data via one of the following:

  • Internet browser (using HTTPS. Worth adding a JSON plug-in to validate and view JSON documents)
  • Command line (e.g. CURL or HTTPie)
  • With any programming language (e.g. Python or R)

Note: Not a bioinformatician? Not to worry. Keep reading.

REST APIs are for everyone including wet-lab scientists with no programming skills (like me). You can still access larger chunks of data from our REST API via the internet browser option or even with some basic knowledge of UNIX to be able to run a HTTPS call on the command line.

But how would you go about doing that?

  • With a browser, you can simply copy and paste the URL in the URL bar in your favourite internet browser (e.g. Firefox, Google Chrome, Safari).

For example, if you paste in the location https://platform-api.opentargets.io/v3/platform/public/utils/stats in the URL bar, you will retrieve the statistics as per the latest release of the Open Targets Platform.

That URL will give you the number of targets (i.e. genes), the number of diseases and the number of somatic mutations we have to associate genes to cancer, plus much more.

Check our API tutorials for more examples and use cases.

  • With a terminal window, you can access our API using command lines such as CURL e.g.

curl -X GET https://platform-api.opentargets.io/v3/platform/public/utils/stats for the number of targets, associations, evidence and diseases among other stats.

curl -X GET "https://platform-api.opentargets.io/v3/platform/public/association/filter?target=ENSG00000100652&target=ENSG00000125255&target=ENSG00000126903&target=ENSG00000137571&target=ENSG00000205359&target=ENSG00000173930" for the association scores for a few targets (you need to use Ensembl Gene IDs).

  • If you code in Python, you can use the Open Targets Platform Python client.

Whether you use the internet browser, a terminal window or our clients, let’s have a look at this use case:

Franke et al (2006) have found three genes associated with Congenital stationary night blindness: ENSG00000163914, ENSG00000114349 and ENSG00000133256.

Question 1:

"How can I find out all diseases (besides Congenital stationary night blindness) associated with those three Ensembl gene IDs?"

Try this:

  • Response you will get, viewed in a browser, with JSON view:

enter image description here

  • Response you will get, viewed in a terminal window with HTTPie when using http GET "https://platform-api.opentargets.io/v3/platform/public/association/filter?target=ENSG00000100652&target=ENSG00000125255&target=ENSG00000126903&target=ENSG00000137571&target=ENSG00000205359&target=ENSG00000173930"

enter image description here

Question 2:

"Which diseases have got the highest overall association score for each of those three genes?"

One option is: https://platform-api.opentargets.io/v3/platform/public/association/filter?target=ENSG00000163914&target=ENSG00000114349&target=ENSG00000133256&fields=association_score.overall&fields=target.id&fields=disease.id&size=10000

Question 3:

"Can I download the above list in TAB format?"

Yes, you can. Just add ‘&format=tab’ to the previous URL and there you are.


Note: TAB is not the only format you can output the data from our API: we support XML and CSV too.

Question 4:

"I’m relatively new to REST URLs. How can I break them down?"

You will do so in three parts (server, endpoint parameters and optional parameters). Check this example:



Endpoint parameters:


Optional parameters:


Want extra help?

Check the Open Targets Platform REST API documentation page for more details.

If you have questions or suggestions on our REST API, get in touch.

open-targets disease API drug • 5.5k views
Entering edit mode

Check the Take a REST of manual searches with the Open Targets API webinar for more details. Plus additional webinars on the REST theme, as part of the EMBL-EBI programmatically series of webinars

Entering edit mode

@Denise, do you know why mouse models for SCN1A are not included in the platform? To the best of my knowledge, both MGI and Monarch have it. Thanks!

Entering edit mode

@Eric, we have the mouse models associated with SCN1A in the target profile page of SCN1A. They are listed in the Mouse phenotypes tab.

However in order to associate SCN1A with a disease we rely on data from Phenodigm, which unfortunately has been archived by the Sanger. I'm guessing the phenotype of the KO mouse was not captured by PhenoDigm before the tool got discontinued.

Entering edit mode

Thanks Denise! That was very helpful!

Entering edit mode

Following some discussion here with the team and looking at the phenotypes for the Scn1a in mouse mutants, we can see there is substantially premature death or poor growth in these mice. These are difficult to map to a specific human disease. This might be one reason why they don't pass the threshold for confidence for PhenoDigm, hence missing evidence for our associations.

However as you highlighted there are mouse models for SCN1A and they were included in our target profile page. But their phenotypes were not mapped to the human phenotypes, hence we can not use that information as evidence to link SCN1A to a disease based on KO mice.

Entering edit mode

How to fetch the entire disease gene association?


Login before adding your answer.

Traffic: 2437 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6