The DGIdb API can be used to query for drug-gene interactions in your own applications through a simple JSON based interface.
All endpoints can be reached at:
https://dgidb.org
Documentation for v1 of the API (deprecated) can be found here.
The interactions endpoint can be used to return interactions for a given set of gene or drug names/symbols. It also allows you to filter returned interactions.
GET/api/v2/interactions.json?<parameters>
Note:
While the preferred method for accessing this endpoint is a
GET
request, it will also accept
POST
requests to accommodate large gene lists if needed.
Parameter | Description | Example |
genes / drugs (required) | A comma delimited list of gene or drug names/symbols. |
genes=FLT1,STK1,FAKE1
or
drugs=FICLATUZUMAB,ETOPOSIDE,NOTREAL
|
interaction_sources (optional) | A comma delimited list of source names to include in the result set. If this field is omitted, all sources will be included. |
interaction_sources=TTD,DrugBank
|
interaction_types (optional) | A comma delimited list of interaction types to include in the result set. If this field is omitted, all interaction types will be included. |
interaction_types=inhibitor,activator
|
fda_approved_drug (optional) | A flag denoting whether or not to limit interactions to only the ones involving fda-approved drugs. If this field is omitted, interactions for all types of drugs will be included. |
fda_approved_drug=true
|
immunotherapy (optional) | A flag denoting whether or not to limit interactions to only the ones involving immunotherapeutic drugs. If this field is omitted, interactions for all types of drugs will be included. |
immunotherapy=true
|
anti_neoplastic (optional) | A flag denoting whether or not to limit interactions to only the ones involving antineoplastic drugs. If this field is omitted, interactions for all types of drugs will be included. |
anti_neoplastic=true
|
clinically_actionable (optional) | A flag denoting whether or not to limit interactions to only the ones involving clinically actionable genes. If this field is omitted, interactions for all types of genes will be included. |
clinically_actionable=true
|
druggable_genome (optional) | A flag denoting whether or not to limit interactions to only the ones involving the durggable genome. If this field is omitted, interactions for all types of genes will be included. |
druggable_genome=true
|
drug_resistance (optional) | A flag denoting whether or not to limit interactions to only the ones involving drug-resistant genes. If this field is omitted, interactions for all types of genes will be included. |
drug_resistance=true
|
gene_categories (optional) | A comma delimited list of gene categories to include in the result set. If this field is omitted, all gene categories will be included. |
gene_categories=kinase,tumor%20suppressor
|
source_trust_levels (optional) | A comma delimited list of source trust levels to include in the result set. If this field is omitted, all trust levels will be included. |
source_trust_levels=Expert%20curated
|
Note: The following example would query DGIdb for interactions involving the genes FLT1, STK1, and FAKE. It will only show interactions reported by the source. TALC.
https://dgidb.org/api/v2/interactions.json?genes=FLT1,MM1,FAKE&interaction_sources=TALC
The response will come back with three top level items:
matchedTerms
will be a list containing a hash for each search term that you provided that we were able
to map unambiguously to an Entrez gene.
Each hash will contain your original search term, the Entrez long and full names
that DGIdb matched them to as well as a list of categories that the given gene is in.
Additionally, the hash will contain a list of drug interactions for the gene. This list
includes interaction type information as well as the drug name and source that reported
the interaction.
ambiguousTerms
will be a list containing a hash of search terms that you provided that mapped to multiple Entrez
genes.
Each hash will contain your original search term, the Entrez long and full names
of the potential math as well as a list of categories that the given gene is in.
Additionally, the hash will contain a list of drug interactions for the gene. This list
includes interaction type information as well as the drug name and source that reported
the interaction.
unmatchedTerms
will be a list of search terms you provided that we were unable to map any Entrez gene.
"matchedTerms": [ { "searchTerm": "FLT1", "geneName": "FLT1", "geneLongName": "fms related tyrosine kinase 1", "entrezId": 2321, "geneCategories": [ { "id": "4c14ec3171544bd2b18b2f1a45e6c8f2", "name": "KINASE" }, { "id": "6c528ef943614261afc5e4f52a3c60ee", "name": "TYROSINE KINASE" }, { "id": "d3ec2631e0b2434b9dcc008e793d3fa5", "name": "DRUGGABLE GENOME" }, { "id": "0d157beb-fd17-404d-8755-3a81aa5ed704", "name": "CLINICALLY ACTIONABLE" } ], "interactions": [ { "interactionId": "841ed1ba-816f-4d62-9c7b-b6c81d79ad14", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "CEDIRANIB", "drugChemblId": "CHEMBL491473", "sources": [ "ChEMBL", "TdgClinicalTrial", "TALC" ], "pmids": [] }, { "interactionId": "4a5005da-4a38-414c-93a8-f6a8d471f801", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "TIVOZANIB", "drugChemblId": "CHEMBL1289494", "sources": [ "ChEMBL", "CancerCommons", "TALC", "MyCancerGenome", "TdgClinicalTrial", "ClearityFoundationClinicalTrial" ], "pmids": [] }, { "interactionId": "fcce486a-92d6-4740-bf56-d5c3ca43f85e", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "VATALANIB", "drugChemblId": "CHEMBL101253", "sources": [ "ChEMBL", "DrugBank", "TALC", "MyCancerGenome", "TdgClinicalTrial" ], "pmids": [] }, { "interactionId": "6919fc44-75fa-41d0-bd11-fa2a2fba0f85", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "MOTESANIB", "drugChemblId": "CHEMBL572881", "sources": [ "ChEMBL", "MyCancerGenome", "TdgClinicalTrial", "TALC" ], "pmids": [] }, { "interactionId": "127a6d88-9bf9-4175-9552-e025e1deba48", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "SUNITINIB", "drugChemblId": "CHEMBL535", "sources": [ "DrugBank", "TEND", "MyCancerGenomeClinicalTrial", "TdgClinicalTrial", "TALC" ], "pmids": [] }, { "interactionId": "8c36e43e-a411-45e0-af46-89195e5dd856", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "AXITINIB", "drugChemblId": "CHEMBL1289926", "sources": [ "ChEMBL", "TALC", "MyCancerGenome", "MyCancerGenomeClinicalTrial", "TdgClinicalTrial", "PharmGKB", "DrugBank", "CancerCommons" ], "pmids": [] }, { "interactionId": "2ab8d600-b787-407e-a4f8-88db0d22a9bf", "interactionTypes": [ "inhibitor" ], "drugName": "REGORAFENIB", "drugChemblId": "CHEMBL1946170", "sources": [ "ChEMBL", "DrugBank", "MyCancerGenome", "MyCancerGenomeClinicalTrial", "TALC" ], "pmids": [] }, { "interactionId": "731d0ad8-7909-474a-a67f-e7f0e94ba42d", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "LENVATINIB", "drugChemblId": "CHEMBL1289601", "sources": [ "DrugBank", "TdgClinicalTrial", "TALC" ], "pmids": [] }, { "interactionId": "9cd02ac8-61ee-4266-8c54-f115288e709a", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "NINTEDANIB", "drugChemblId": "CHEMBL502835", "sources": [ "DrugBank", "TALC", "MyCancerGenome", "TdgClinicalTrial", "ClearityFoundationClinicalTrial" ], "pmids": [] }, { "interactionId": "5f704ee0-153d-4b8d-b203-b41b04cbe256", "interactionTypes": [ "inhibitor", "n/a" ], "drugName": "PAZOPANIB", "drugChemblId": "CHEMBL477772", "sources": [ "MyCancerGenome", "MyCancerGenomeClinicalTrial", "TdgClinicalTrial", "DrugBank", "ClearityFoundationClinicalTrial", "TALC" ], "pmids": [] } ] } ], "ambiguousTerms": [ { "searchTerm": "MM1", "geneName": "PFDN5", "geneLongName": "prefoldin subunit 5", "entrezId": 5204, "geneCategories": [], "interactions": [] }, { "searchTerm": "MM1", "geneName": "PLXNB2", "geneLongName": "plexin B2", "entrezId": 23654, "geneCategories": [ { "id": "26f6a4ea7779433ea2cbf524683accf7", "name": "CELL SURFACE" } ], "interactions": [] } ], "unmatchedTerms": [ "FAKE" ]
When used without a
genes
or
drugs
parameter, the interactions endpoint returns a list of all interactions in the DGIdb database.
This is an index style endpoint and is paginated by default. You can use the
count
and
page
parameters to iterate through all the variants.
https://dgidb.org/api/v2/interactions
Parameter | Default | Description |
page | 1 | Which page of results to return |
count | 25 | How many interactions to return on a single page |
{ "_meta": { "current_page": 1, "per_page": 25, "total_pages": 1878, "total_count": 46929, "links": { "next": "https://dgidb.org/api/v2/interactions?count=25&page=2", "previous": null } }, "records": [ { "id": "001098f2-1b60-4c87-b3dd-245eb04ede43", "gene_name": "SLC12A1", "entrez_id": 6557, "drug_name": "METHYCLOTHIAZIDE", "concept_id": "chembl:CHEMBL1577", "publications": [ 11752352, 17139284, 17016423 ], "interaction_types": [ "inhibitor" ], "interaction_direction": [ "inhibitory" ], "sources": [ "TdgClinicalTrial", "TEND", "TTD" ], "score": 9.09 }, ... ] }
The interaction details endpoint can be used to retrieve detailed information about one particular interaction.
GEThttps://dgidb.org/api/v2/interactions/<interaction_id>
Note:
The following example would query DGIdb for the interaction with
ID
001098f2-1b60-4c87-b3dd-245eb04ede43
https://dgidb.org/api/v2/interactions/001098f2-1b60-4c87-b3dd-245eb04ede43
{ "id": "001098f2-1b60-4c87-b3dd-245eb04ede43", "gene_name": "SLC12A1", "entrez_id": 6557, "drug_name": "METHYCLOTHIAZIDE", "concept_id": "chembl:CHEMBL1577", "publications": [ 17016423, 17139284, 11752352 ], "interaction_types": [ "inhibitor" ], "interaction_direction": [ "inhibitory" ], "sources": [ "TdgClinicalTrial", "TEND", "TTD" ], "score": 9.09, "attributes": [ { "name": "Trial Name", "value": "-", "sources": [ "TdgClinicalTrial" ] }, { "name": "Novel drug target", "value": "Established target", "sources": [ "TdgClinicalTrial" ] } ], "interaction_claims": [ { "source": "TEND", "drug": "METHYCLOTHIAZIDE", "gene": "Q13621", "interaction_types": [], "attributes": [], "publications": [], "source_links": [ { "url": "https://www.nature.com/articles/nrd3478/tables/1", "text": "Trends in the exploitation of novel drug targets, Table 1" } ] }, { "source": "TdgClinicalTrial", "drug": "METHYCLOTHIAZIDE", "gene": "Q13621", "interaction_types": [], "attributes": [ { "name": "Trial Name", "value": "-" }, { "name": "Novel drug target", "value": "Established target" } ], "publications": [], "source_links": [ { "url": "https://www.annualreviews.org/doi/10.1146/annurev-pharmtox-011613-135943", "text": "The druggable genome: Evaluation of drug targets in clinical trials suggests major shifts in molecular class and indication. Rask-Andersen M, Masuram S, Schioth HB. Annu Rev Pharmacol Toxicol. 2014;54:9-26. doi: 10.1146/annurev-pharmtox-011613-135943. PMID: 24016212" } ] }, { "source": "TTD", "drug": "Methyclothiazide", "gene": "Solute carrier family 12 member 1", "interaction_types": [], "attributes": [], "publications": [], "source_links": [ { "url": "http://idrblab.net/ttd/data/target/details/T93878", "text": "TTD Target Information" } ] } ] }
The drugs endpoint can be used to retrieve a list of all drugs in the DGIdb database.
This is an index style endpoint and is paginated by default. You can use the
count
and
page
parameters to iterate through all the variants.
https://dgidb.org/api/v2/drugs
Parameter | Default | Description |
page | 1 | Which page of results to return |
count | 25 | How many drugs to return on a single page |
{ "_meta": { "current_page": 1, "per_page": 25, "total_pages": 578, "total_count": 14449, "links": { "next": "https://dgidb.org/api/v2/drugs?count=25&page=2", "previous": null } }, "records": [ { "name": "ELLAGIC ACID", "concept_id": "chembl:CHEMBL6246", "approved": false, "immunotherapy": false, "anti_neoplastic": false, "alias": [ "NSC-407286", "BENZOARIC ACID", "NSC-656272", "ELLAGIC ACID" ] }, ... ] }
The drug details endpoint can be used to retrieve detailed information about one particular drug using the drug's
concept_id
https://dgidb.org/api/v2/drugs/<concept_id>
Note:
The following example would query DGIdb for the drug with
concept_id
chembl:CHEMBL1237026
https://dgidb.org/api/v2/drugs/chembl:CHEMBL1237026
{ "name": "TESAMORELIN", "concept_id": "chembl:CHEMBL1237026", "approved": true, "immunotherapy": false, "anti_neoplastic": false, "alias": [ "TH9507", "TH-9507", "TESAMORELIN", "TESAMORELIN ACETATE", "N-(TRANS-3-HEXENOYL)-HUMAN GROWTH HORMONE RELEASING FACTOR (1-44) ACETATE", "EGRIFTA", "drugbank:08869", "pubchem.compound:16137828", "chemidplus:218949-48-5", "chembl:CHEMBL1237026", "rxcui:1044584" ], "pmids": [ 22298602 ], "attributes": [ { "name": "Drug Class", "value": "antilipodystrophy agents", "sources": [ "TEND" ] }, { "name": "Year of Approval", "value": "2010", "sources": [ "TEND" ] }, { "name": "FDA Approval", "value": "approved", "sources": [ "TdgClinicalTrial" ] }, { "name": "Drug Class", "value": "peptide", "sources": [ "TdgClinicalTrial" ] }, { "name": "Drug Indications", "value": "for treatment of HIV-associated lipodystrophy", "sources": [ "TdgClinicalTrial" ] } ], "drug_claims": [ { "source": "ChemblDrugs", "name": "chembl:CHEMBL1237026", "primary_name": "TESAMORELIN", "aliases": [], "attributes": [], "publications": [] }, { "source": "TEND", "name": "TESAMORELIN", "primary_name": "TESAMORELIN", "aliases": [ "TESAMORELIN" ], "attributes": [ { "name": "Drug Class", "value": "antilipodystrophy agents" }, { "name": "Year of Approval", "value": "2010" } ], "publications": [] }, { "source": "TdgClinicalTrial", "name": "TESAMORELIN", "primary_name": "TESAMORELIN", "aliases": [], "attributes": [ { "name": "Drug Class", "value": "peptide" }, { "name": "Drug Indications", "value": "for treatment of HIV-associated lipodystrophy" }, { "name": "FDA Approval", "value": "approved" } ], "publications": [] }, { "source": "GuideToPharmacology", "name": "178103540", "primary_name": "TESAMORELIN", "aliases": [ "TESAMORELIN" ], "attributes": [], "publications": [] }, { "source": "TTD", "name": "Tesamorelin", "primary_name": "Tesamorelin", "aliases": [ "D0UL9R" ], "attributes": [], "publications": [] } ] }
The genes endpoint can be used to retrieve a list of all genes in the DGIdb database.
This is an index style endpoint and is paginated by default. You can use the
count
and
page
parameters to iterate through all the variants.
https://dgidb.org/api/v2/genes
Parameter | Default | Description |
page | 1 | Which page of results to return |
count | 25 | How many genes to return on a single page |
{ "_meta": { "current_page": 1, "per_page": 25, "total_pages": 1644, "total_count": 41100, "links": { "next": "http://dgidb.org/api/v2/genes?count=25&page=2", "previous": null } }, "records": [ { "name":"A1BG", "long_name":"alpha-1-B glycoprotein", "entrez_id":1, "aliases":[ "A1B", "ABG", "GAB", "HYST2477", "ENSG00000121410" ] }, ... ] }
The gene details endpoint can be used to retrieve detailed information about one particular gene.
GEThttps://dgidb.org/api/v2/genes/<entrez_id>
Note:
The following example would query DGIdb for the gene with
Entrez ID
346
https://dgidb.org/api/v2/genes/346
{ "name":"APOC4", "long_name":"apolipoprotein C4", "entrez_id":346, "aliases":[ "APO-CIV", "APOC-IV", "ENSG00000224916", "P55056", "apolipoprotein C-IV","346", "ENSG00000267467", "P21731", "TBXA2R", "TP receptor" ], "pmids":[ 1386885, 10634944, 2530338, 2968449, 1387312, 1833018, 1825698, 16604093, 2975605, 1830308, 1434130, 8437108, 3008368, 11454901, 2527074, 8242228, 9871769, 2743082 ], "attributes":[ { "name":"Gene Biotype", "value":"PROTEIN_CODING", "sources":[ "Ensembl" ] } ], "categories":[ "TRANSPORTER" ], "gene_claims":[ { "source":"GuideToPharmacologyInteractions", "name":"346", "aliases":[ "P21731", "TBXA2R", "TP receptor" ], "attributes":[], "publications":[ 10634944, 8242228, 2748606, 8859002, 1434130, 10537280, 8882612, 3594077, 1386885, 2530338, 2968449, 1387312, 1833018, 16604093, 2975605, 1830308, 8437108, 3008368, 11454901, 2527074, 9871769, 2743082, 1825698 ] }, { "source":"Ensembl", "name":"ENSG00000224916", "aliases":[ "ENSG00000224916", "APOC4" ], "attributes":[ { "name":"Gene Biotype", "value":"PROTEIN_CODING" } ], "publications":[] }, { "source":"GO", "name":"APOC4", "aliases":[ "P55056" ], "attributes":[], "publications":[] } ] }
The interaction types endpoint can be used to retrieve a current list of supported interaction types for use in the interactions endpoint.
GEThttps://dgidb.org/api/v2/interaction_types.json
["activator", "inhibitor", "unknown"]
The interaction sources endpoint can be used to retrieve a current list of supported interaction sources for use in calls to the interactions endpoint.
GEThttps://dgidb.org/api/v2/interaction_sources.json
["DrugBank","PharmGKB","TALC","TEND","TTD"]
The gene categories endpoint can be used to retrieve a current list of supported gene categories for use in calls to the interactions endpoint.
GEThttps://dgidb.org/api/v2/gene_categories.json
["KINASE", "DNA REPAIR", "TUMOR SUPPRESSOR"]
The source trust levels endpoint can be used to retrieve a current list of supported source trust levels for use in calls to the interactions endpoint.
GEThttps://dgidb.org/api/v2/source_trust_levels.json
["Expert curated", "Non-curated"]
The Genes in Category endpoint can be used to get a list of all genes in DGIdb that are known to be in a specific category.
GET/api/v2/genes_in_category.json?<parameters>
Parameter | Description | Example |
category (required) | The name of the category to retrieve genes from |
category=kinase
|
Note: The following example would query DGIdb for a list of genes known to be Kinases
https://dgidb.org/api/v2/genes_in_category.json?category=kinase
["SNRK","BCR","FKBP1A","TAB2","DGKE","PHKA1","PRKCH"]
Currently, all API responses are provided only in JSON. If you are experimenting with the API in your browser and you want to improve the display for JSON output you use a JSON formatter such as this one.
The DGIdb API can respond to requests with a number of status codes. They are explained in the table below.
Code | Meaning |
200 | Success. Your query was processed and the response contains the information that was requested. |
400 | Bad Request. Something about your request was malformed or incorrect. The response will contain an error message indicating what was wrong. |
404 | Resource Not Found. This indicates that you attempted to get a resource that doesn't exist. |
50X | Server Error. This means there was a server side error processing your request. An email will be automatically dispatched to the developer notifying them of the problem. |
A sample Perl application that interacts with DGIdb can be found
on github.
Use the command line script to search for interactions FLT3 or EGFR, and limit to drugs that act as inhibitors:
EXECUTE EXAMPLE SCRIPT
wget https://raw.github.com/genome/dgi-db/master/files/perl_example.plINSTALL INSTRUCTIONS
chmod +x perl_example.pl
./perl_example.pl --genes='FLT3,EGFR' --interaction_types='inhibitor'
You may need to install the 'json' package from
cpan
before this script will work.
On a mac you can do the following:
First configure the 'cpan' tool:
sudo cpanThen at the 'cpan' prompt:
get JSON
make JSON
install JSON
q
A sample Python application that interacts with DGIdb can be found
on github.
Use the command line script to search for interactions FLT3 or EGFR, and limit to drugs that act as inhibitors:
EXECUTE EXAMPLE SCRIPT
wget https://raw.github.com/genome/dgi-db/master/files/python_example.pyINSTALL INSTRUCTIONS
chmod +x python_example.py
./python_example.py --genes='FLT3,EGFR' --interaction_types='inhibitor'
This example uses the 'requests' python library. Installing 'requests' is easiest with 'pip' which is one of the easiest and recommended ways to install Python packages.:
sudo pip install requestsIf you don't have pip, see the pip home-page.
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
A small Ruby client library, along with a short usage demo can be found
on github.
Use the client library to search for interactions involving FLT3 or EGFR, only from trusted sources:
SAMPLE CODE
client = DgidbApiClient.newEXECUTE EXAMPLE SCRIPT
query_params = { source_trust_levels: 'Expert curated', genes: 'FLT3,EGFR' }
interaction_results = client.query(:interactions, query_params)
wget https://raw.github.com/genome/dgi-db/master/files/ruby_example.rb
ruby ruby_example.rb
A small tutorial showing command-line usage of the DGIdb API using shell commands
on github.
Try the following examples from the command line to view and format output from the API:
SAMPLE CODE
curl https://dgidb.org/api/v2/interactions.json
curl https://dgidb.org/api/v2/interactions.json?genes=FLT3
curl https://dgidb.org/api/v2/interactions.json?genes=FLT3 | python -mjson.tool
curl https://dgidb.org/api/v2/interactions.json?genes=FLT3,STK1,FAKE1 | python -mjson.tool
curl https://dgidb.org/api/v2/interactions.json?genes=STK1,FAKE1 | python -mjson.tool
curl https://dgidb.org/api/v2/interactions.json?genes=STK1,FAKE1 | python -mjson.tool
curl https://dgidb.org/api/v2/interactions.json?genes=FLT3,STK1,FAKE1&interaction_sources=TTD,DrugBank | python -mjson.tool
curl https://dgidb.org/api/v2/interactions.json?genes=FLT3,STK1,FAKE1&interaction_sources=TTD,DrugBank&interaction_type=inhibitor | python -mjson.tool