Open Targets Platform Query Skill
Query the Open Targets GraphQL API for drug, target, and disease association data. No API key required.
Entity Auto-Detection
| Input Pattern |
Detected As |
Example |
ENSG00000... |
Target (Ensembl gene ID) |
ENSG00000146648 (EGFR) |
CHEMBL... |
Drug (ChEMBL ID) |
CHEMBL941 (Imatinib) |
| anything else |
Free-text search |
BRCA1, aspirin |
API
| Function |
Input |
Returns |
query(entity) |
single entity string |
dict with type, name, associations |
query_batch(entities) |
list of entity strings |
list[dict] |
summarize(result) |
query result dict |
compact one-line text |
get_target_info(ensembl_id) |
Ensembl ID string |
raw GraphQL response |
get_drug_info(chembl_id) |
ChEMBL ID string |
raw GraphQL response |
search_entities(term) |
free-text string |
raw GraphQL response |
Return Format
Target result:
{"entity": "ENSG00000146648", "type": "target", "found": true,
"symbol": "EGFR", "name": "epidermal growth factor receptor",
"biotype": "protein_coding",
"top_diseases": [{"disease": "lung carcinoma", "score": 0.78}]}
Drug result:
{"entity": "CHEMBL941", "type": "drug", "found": true,
"name": "IMATINIB", "drug_type": "Small molecule",
"max_phase": 4,
"indications": [{"disease": "chronic myeloid leukemia", "phase": 4}]}
Search result:
{"entity": "BRCA1", "type": "search", "found": true,
"hits": [{"id": "ENSG00000012048", "name": "BRCA1", "entity_type": "target"}]}
Usage
See if __name__ == "__main__" block in 12_Open_Targets_Platform.py for runnable examples covering: single target/drug/search query, batch query, and JSON output.
Source
1---2name: open-targets-platform3description: Query the Open Targets Platform for drug-target-disease associations. Use whenever the user asks about drug targets, gene-disease associations, drug indications, clinical trial phases, or wants to look up any entity (Ensembl gene ID, ChEMBL drug ID, or free-text gene/drug name) in Open Targets. Also trigger when the user mentions Open Targets, ENSG IDs, CHEMBL IDs, or asks about target prioritization for diseases.4---5
6# Open Targets Platform Query Skill
7
8Query the Open Targets GraphQL API for drug, target, and disease association data. No API key required.
9
10## Entity Auto-Detection
11
12| Input Pattern | Detected As | Example |
13|---|---|---|
14| `ENSG00000...` | Target (Ensembl gene ID) | `ENSG00000146648` (EGFR) |
15| `CHEMBL...` | Drug (ChEMBL ID) | `CHEMBL941` (Imatinib) |
16| anything else | Free-text search | `BRCA1`, `aspirin` |
17
18## API
19
20| Function | Input | Returns |
21|---|---|---|
22| `query(entity)` | single entity string | dict with type, name, associations |
23| `query_batch(entities)` | list of entity strings | list[dict] |
24| `summarize(result)` | query result dict | compact one-line text |
25| `get_target_info(ensembl_id)` | Ensembl ID string | raw GraphQL response |
26| `get_drug_info(chembl_id)` | ChEMBL ID string | raw GraphQL response |
27| `search_entities(term)` | free-text string | raw GraphQL response |
28
29## Return Format
30
31**Target result:**
32```json
33{"entity": "ENSG00000146648", "type": "target", "found": true,
34 "symbol": "EGFR", "name": "epidermal growth factor receptor",
35 "biotype": "protein_coding",
36 "top_diseases": [{"disease": "lung carcinoma", "score": 0.78}]}
37```
38
39**Drug result:**
40```json
41{"entity": "CHEMBL941", "type": "drug", "found": true,
42 "name": "IMATINIB", "drug_type": "Small molecule",
43 "max_phase": 4,
44 "indications": [{"disease": "chronic myeloid leukemia", "phase": 4}]}
45```
46
47**Search result:**
48```json
49{"entity": "BRCA1", "type": "search", "found": true,
50 "hits": [{"id": "ENSG00000012048", "name": "BRCA1", "entity_type": "target"}]}
51```
52
53## Usage
54
55See `if __name__ == "__main__"` block in `12_Open_Targets_Platform.py` for runnable examples covering: single target/drug/search query, batch query, and JSON output.
56
57## Source
58
59- **Endpoint**: `https://api.platform.opentargets.org/api/v4/graphql`
60- **Docs**: https://platform.opentargets.org/
61- **Paper**: https://doi.org/10.1093/nar/gkac1046