app/views/static/api_v1.html.haml
#notice= notice
=content_for :title do
=tx "title"
=content_for :header do
%h2
=tx 'title_main'
%small=tx 'title_small'
-cache do
.row
.span3#navbar{style: "float: left; display: block; font-size: 14px; box-sizing: border-box;"}
#api-sidebar.well.affix{style: "min-height: 20px; padding: 19px; margin-bottom: 20px; display: block;"}
%ul.nav.nav-list{style: "padding-left: 15px; padding-right: 15px; margin-bottom: 0px; margin-left: 0px; display: block; line-height: 20px;"}
%li.nav-header Introduction
%li.nav-header Endpoints
%li
%a{href: '#search-interactions'} Search Interactions
%li
%a{href: '#interaction-types'} Interaction Types
%li
%a{href: '#interaction-sources'} Interaction Sources
%li
%a{href: '#drug-types'} Drug Types
%li
%a{href: '#gene-categories'} Gene Categories
%li
%a{href: '#source-trust-levels'} Source Trust Levels
/
%li
%a{href: '#related-genes'} Related Genes
%li
%a{href: '#genes-in-category'} Genes in Category
%li.divider
%li.nav-header Responses
%li
%a{href: '#formats'}Formats
%li
%a{href: '#status-codes'}Status Codes
%li.divider
%li.nav-header Sample Code
%li
%a{href: '#perl-sample'}Perl
%li
%a{href: '#python-sample'}Python
%li
%a{href: '#ruby-sample'}Ruby
%li
%a{href: '#shell-sample'}Shell
%li.divider
.span9{style: "float: left; width: 700px; margin-left: 20px; display: block;"}
%h2 Introduction
%p
The DGIdb API can be used to query for drug-gene interactions in your own applications
through a simple JSON based interface.
%p
All endpoints can be reached at:
%code http://dgidb.org
.page-header
%section
%h2
Endpoints
%small available API method calls
%section#search-interactions
%h3 Search Interactions
%p.lead
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.
%span.label GET
%pre
\/api/v1/interactions.json
%p
%small
%span.label.label-info Note:
While the preferred method for accessing this endpoint is a
%code GET
request, it will also accept
%code POST
requests to accommodate large gene lists if needed.
%h5 Accepted Parameters:
%table.table.table-bordered.table-striped
%thead
%tr
%td Parameter
%td Description
%td Example
%tbody
%tr
%td
genes / drugs
%small (required)
%td A comma delimited list of gene or drug names/symbols.
%td
%code genes=FLT1,STK1,FAKE1
%em or
%code drugs=FICLATUZUMAB,ETOPOSIDE,NOTREAL
%tr
%td
interaction_sources
%small (optional)
%td
A comma delimited list of source names to include in the result set.
If this field is omitted, all sources will be included.
%td
%code interaction_sources=TTD,DrugBank
%tr
%td
interaction_types
%small (optional)
%td
A comma delimited list of interaction types to include in the result set.
If this field is omitted, all interaction types will be included.
%td
%code interaction_types=inhibitor,activator
%tr
%td
drug_types
%small (optional)
%td
A comma delimited list of drug types to include in the result set.
If this field is omitted, all drug types will be included.
%td
%code drug_types=antineoplastic
%tr
%td
gene_categories
%small (optional)
%td
A comma delimited list of gene categories to include in the result set.
If this field is omitted, all gene categories will be included.
%td
%code gene_categories=kinase,tumor%20suppressor
%tr
%td
source_trust_levels
%small (optional)
%td
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.
%td
%code source_trust_levels=Expert%20curated
%h5
Example Call:
%p
%span.label.label-info Note:
%small
The following example would query DGIdb for interactions involving the genes
FLT1, STK1, and FAKE. It will only show interactions with antineoplastic drugs reported
by the source.
=link_to('TALC', source_path('TALC')) + '.'
%pre
\http://dgidb.org/api/v1/interactions.json?genes=FLT1,MM1,FAKE&drug_types=antineoplastic&interaction_sources=TALC
%h5 Example Response:
%p
The response will come back with two top level items:
%p
%code 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.
%p
%code unmatchedTerms
will be a list containing a hash for each search term that you provided that we were unable
to map definitiely to a single Entrez gene. Each hash will contain both the orignal search
term and a list of possible suggestions if the search term was ambiguous.
%button.btn.btn-mini.btn-link{data: { toggle: 'collapse', target: '#example-interaction-response'}}
Show/Hide Response
%pre#example-interaction-response.collapse
:preserve
"matchedTerms":[
{
"searchTerm":"FLT3",
"geneName":"FLT3",
"geneLongName":"fms-related tyrosine kinase 3",
"geneCategories":[
"TYROSINE KINASE",
"DRUGGABLE GENOME",
"KINASE",
"CELL SURFACE"
],
"interactions":[
{
"interactionId":"61577575-b8ec-4916-a25f-edb362047b97",
"interactionType":"inhibitor",
"drugName":"SORAFENIB",
"source":"TALC"
},
{
"interactionId":"318383b3-3cd5-478d-ada2-f26977caf8eb",
"interactionType":"inhibitor",
"drugName":"AMUVATINIB",
"source":"TALC"
},
{
"interactionId":"a961d382-4b52-435f-a610-f27673184b09",
"interactionType":"inhibitor",
"drugName":"SUNITINIB",
"source":"TALC"
},
{
"interactionId":"e3b974f9-cfce-4fa7-9dec-80643c84a571",
"interactionType":"inhibitor",
"drugName":"AS703569",
"source":"TALC"
},
{
"interactionId":"a211e2dc-7e76-45f9-a031-0ad7b24a5ea0",
"interactionType":"inhibitor",
"drugName":"XL999",
"source":"TALC"
},
{
"interactionId":"8732ec65-58bb-4dfa-a82d-a335f67bc051",
"interactionType":"inhibitor",
"drugName":"ENMD-0276",
"source":"TALC"
}
]
}
],
"unmatchedTerms":[
{
"searchTerm":"MM1",
"suggestions":[
"PFDN5",
"PLXNB2"
]
},
{
"searchTerm":"FAKE",
"suggestions":[
]
}
]}
%hr
%section#interaction-types
%h3 Interaction Types
%p.lead
The interaction types endpoint can be used to retrieve a current list of supported
interaction types for use in the interactions endpoint.
%span.label GET
%pre
\http://dgidb.org/api/v1/interaction_types.json
%h5 Example Response:
%pre
["activator", "inhibitor", "unknown"]
%hr
%section#interaction-sources
%h3 Interaction Sources
%p.lead
The interaction sources endpoint can be used to retrieve a current list of supported
interaction sources for use in calls to the interactions endpoint.
%span.label GET
%pre
\http://dgidb.org/api/v1/interaction_sources.json
%h5 Example Response:
%pre
["DrugBank","PharmGKB","TALC","TEND","TTD"]
%hr
%section#drug-types
%h3 Drug Types
%p.lead
The drug types endpoint can be used to retrieve a current list of supported
drug types for use in calls to the interactions endpoint.
%span.label GET
%pre
\http://dgidb.org/api/v1/drug_types.json
%h5 Example Response:
%pre
["antineoplastic"]
%hr
%section#gene-categories
%h3 Gene Categories
%p.lead
The gene categories endpoint can be used to retrieve a current list of supported
gene categories for use in calls to the interactions endpoint.
%span.label GET
%pre
\http://dgidb.org/api/v1/gene_categories.json
%h5 Example Response:
%pre
["KINASE", "DNA REPAIR", "TUMOR SUPPRESSOR"]
%hr
%section#source-trust-levels
%h3 Source Trust Levels
%p.lead
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.
%span.label GET
%pre
\http://dgidb.org/api/v1/source_trust_levels.json
%h5 Example Response:
%pre
["Expert curated", "Non-curated"]
%hr
/
%section#related-genes
%h3 Related Genes
%p.lead
The related genes endpoint can be used to return Entrez gene symbols for other
genes that are known to interact in pathways with your gene list
%span.label GET
%pre
\/api/v1/related_genes.json
%h5 Accepted Parameters:
%table.table.table-bordered.table-striped
%thead
%tr
%td Parameter
%td Description
%td Example
%tbody
%tr
%td
genes
%small (required)
%td A comma delimited list of Entrez gene symbols
%td
%code genes=FLT1,STK1,FAKE1
%h5
Example Call:
%p
%span.label.label-info Note:
%small
The following example would query DGIdb for a list of genes known to interact with
FLT1 or FLT3
%pre
\http://dgidb.org/api/v1/related_genes.json?genes=FLT1,FLT3
%h5 Example Response:
%p
The response will come back containing a list of hashes each with two keys:
%p
%code geneSymbol
will be the gene symbol you passed in to DGIdb
%p
%code relatedGenes
will be a list of gene symbols for genes known to interact with the entered gene
%button.btn.btn-mini.btn-link{data: { toggle: 'collapse', target: '#example-related-genes-response'}}
Show/Hide Response
%pre#example-related-genes-response.collapse
:preserve
{
"genes":[
{
"gene_name":"FLT1",
"related_genes":[
"ATR",
"CRK",
"CTNNB1",
"PTK2B",
"PLCG1",
"PGF",
"VEGFB",
"SHC2",
"SHC1",
"KDR",
"UBC",
"NEDD4",
"PTPN11",
"VEGFA",
"NCK1",
"PIK3R1",
"NRP1",
"NRP2",
"FYN",
"YES1",
"PLCG2",
"GRB2",
"PTK2"
]
},
{
"gene_name":"FLT3",
"related_genes":[
"CBLB",
"SOCS1",
"GRB2",
"UBC",
"PIK3R1",
"HSP90AA1",
"IKBKG",
"SIAH1",
"UBE2L6",
"SIRT2",
"SLA",
"SOCS2",
"INPP5D",
"NCK1",
"PTPN6",
"FLT3LG",
"SH3BP2",
"PTPN12",
"FIZ1"
]
}
]
}
%hr
%section#genes-in-category
%h3 Genes in Category
%p.lead
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.
%span.label GET
%pre
\/api/v1/genes_in_category.json
%h5 Accepted Parameters:
%table.table.table-bordered.table-striped
%thead
%tr
%td Parameter
%td Description
%td Example
%tbody
%tr
%td
category
%small (required)
%td The name of the category to retrieve genes from
%td
%code category=kinase
%h5
Example Call:
%p
%span.label.label-info Note:
%small
The following example would query DGIdb for a list of genes known to be Kinases
%pre
\http://dgidb.org/api/v1/genes_in_category.json?category=kinase
%h5 Example Response:
%button.btn.btn-mini.btn-link{data: { toggle: 'collapse', target: '#example-genes-in-category-response'}}
Show/Hide Response
%pre#example-genes-in-category-response.collapse
:preserve
["SNRK","BCR","FKBP1A","TAB2","DGKE","PHKA1","PRKCH"]
%hr
.page-header
%section
%h2
Responses
%small response information
%section#formats
%h3 Formats
%p
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
=link_to 'this one.', 'http://jsonformatter.curiousconcept.com/'
%hr
%section#status-codes
%h3 Status Codes
%p
The DGIdb API can respond to requests with a number of status codes.
They are explained in the table below.
%table.table.table-bordered.table-striped
%thead
%tr
%td Code
%td Meaning
%tbody
%tr
%td
%span.label.label-success
200
%td
Success. Your query was processed and the response contains the
information that was requested.
%tr
%td
%span.label.label-warning
400
%td
Bad Request. Something about your request was malformed or incorrect.
The response will contain an error message indicating what was wrong.
%tr
%td
%span.label.label-warning
404
%td
Resource Not Found. This indicates that you attempted to get a resource
that doesn't exist.
%tr
%td
%span.label.label-important
50X
%td
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.
%hr
.page-header
%section
%h2
Sample Code
%small get started using DGIdb in the language of your choice
%section#perl-sample
%h3= link_to 'Perl', 'https://github.com/genome/dgi-db/blob/master/files/perl_example.pl'
%p
A sample Perl application that interacts with DGIdb can be found
=link_to 'on github.', 'https://raw.github.com/genome/dgi-db/master/files/perl_example.pl'
<br><br>Use the command line script to search for interactions FLT3 or EGFR, and limit to drugs that act as inhibitors:<br>
%span.label EXECUTE EXAMPLE SCRIPT
%pre
wget https://raw.github.com/genome/dgi-db/master/files/perl_example.pl<br>chmod +x perl_example.pl<br>./perl_example.pl --genes='FLT3,EGFR' --interaction_types='inhibitor'
%span.label INSTALL INSTRUCTIONS<br>
%p
<br>You may need to install the 'json' package from
=link_to 'cpan', '(http://www.cpan.org/modules/INSTALL.html)'
before this script will work.
<br>On a mac you can do the following:
<br><br>First configure the 'cpan' tool:
%pre
sudo cpan<br>
Then at the 'cpan' prompt:
%pre
get JSON<br>make JSON<br>install JSON<br>q
%hr
%section#python-sample
%h3= link_to 'Python', 'https://github.com/genome/dgi-db/blob/master/files/python_example.py'
%p
A sample Python application that interacts with DGIdb can be found
=link_to 'on github.', 'https://raw.github.com/genome/dgi-db/master/files/python_example.py'
<br><br>Use the command line script to search for interactions FLT3 or EGFR, and limit to drugs that act as inhibitors:<br>
%span.label EXECUTE EXAMPLE SCRIPT
%pre
wget https://raw.github.com/genome/dgi-db/master/files/python_example.py<br>chmod +x python_example.py<br>./python_example.py --genes='FLT3,EGFR' --interaction_types='inhibitor'
%span.label INSTALL INSTRUCTIONS<br>
%p
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.:
%pre
sudo pip install requests
If you don't have pip, see
=link_to 'the pip home-page.', 'http://www.pip-installer.org/en/latest/installing.html'
<br>or you can do this,
%pre
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py<br>sudo python get-pip.py
%section#ruby-sample
%h3= link_to 'Ruby', 'https://github.com/genome/dgi-db/blob/master/files/ruby_example.rb'
%p
A small Ruby client library, along with a short usage demo can be found
=link_to 'on github.','https://github.com/genome/dgi-db/blob/master/files/ruby_example.rb'
<br><br>Use the client library to search for interactions involving FLT3 or EGFR, only from trusted sources:<br>
%span.label SAMPLE CODE
%pre
client = DgidbApiClient.new<br>query_params = { source_trust_levels: 'Expert curated', genes: 'FLT3,EGFR' }<br>interaction_results = client.query(:interactions, query_params)
%span.label EXECUTE EXAMPLE SCRIPT
%pre
wget https://raw.github.com/genome/dgi-db/master/files/ruby_example.rb<br>ruby ruby_example.rb
%hr
%section#shell-sample
%h3= link_to 'Shell', 'https://github.com/genome/dgi-db/blob/master/files/shell_example.sh'
%p
A small tutorial showing command-line usage of the DGIdb API using shell commands
=link_to 'on github.','https://github.com/genome/dgi-db/blob/master/files/shell_example.sh'
<br><br>Try the following examples from the command line to view and format output from the API:<br>
%span.label SAMPLE CODE
%pre
curl http://dgidb.org/api/v1/interactions.json<br><br>curl http://dgidb.org/api/v1/interactions.json?genes=FLT3<br><br>curl http://dgidb.org/api/v1/interactions.json?genes=FLT3 | python -mjson.tool<br><br>curl http://dgidb.org/api/v1/interactions.json?genes=FLT3,STK1,FAKE1 | python -mjson.tool<br><br>curl http://dgidb.org/api/v1/interactions.json?genes=STK1,FAKE1 | python -mjson.tool<br><br>curl http://dgidb.org/api/v1/interactions.json?genes=STK1,FAKE1 | python -mjson.tool<br><br>curl http://dgidb.org/api/v1/interactions.json?genes=FLT3,STK1,FAKE1\&interaction_sources=TTD,DrugBank | python -mjson.tool<br><br>curl http://dgidb.org/api/v1/interactions.json?genes=FLT3,STK1,FAKE1\&interaction_sources=TTD,DrugBank\&interaction_type=inhibitor | python -mjson.tool<br>
%hr
:css
.nav > li {
position: relative;
display: block;
}
.nav-list>li>a {
padding: 3px 15px;
margin-left: 0px;
margin-right: 0px;
}
.nav>li>a {
display: block;
}
h2 {
font-size: 31.5px;
line-height: 40px;
margin: 10px 0;
font-family: inherit;
font-weight: bold;
color-inherit;
}
.label, .badge {
background-color: #999999;
display: inline-block;
margin-bottom: 5px;
}
.label-info {
background-color: #5bc0de;
display: inline;
}
list .nav-header {
margin-left: -15px;
margin-right: -15px;
text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.nav-header {
display: block;
padding: 3px 15px;
font-size: 11px;
font-weight: bold;
line-height: 20px;
color: #999999;
text-transform: uppercase;
}
.nav-list .divider {
height: 1px;
margin: 9px 1px;
overflow: hidden;
background-color: #e5e5e5;
border-botom: 1px solid #ffffff;
}
li {
line-height: 20px;
}
li {
display: list-item;
text-align: -webkit-match-parent;
}
:javascript
$(document).ready(function() {
$('body').attr('data-spy', 'scroll');
$('body').attr('data-target', '#navbar');
});