$npx -y skills add QSong-github/DrugClaw --skill open_targetsQuery 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) i
| 1 | # Open Targets Platform Query Skill |
| 2 | |
| 3 | Query the Open Targets GraphQL API for drug, target, and disease association data. No API key required. |
| 4 | |
| 5 | ## Entity Auto-Detection |
| 6 | |
| 7 | | Input Pattern | Detected As | Example | |
| 8 | |---|---|---| |
| 9 | | `ENSG00000...` | Target (Ensembl gene ID) | `ENSG00000146648` (EGFR) | |
| 10 | | `CHEMBL...` | Drug (ChEMBL ID) | `CHEMBL941` (Imatinib) | |
| 11 | | anything else | Free-text search | `BRCA1`, `aspirin` | |
| 12 | |
| 13 | ## API |
| 14 | |
| 15 | | Function | Input | Returns | |
| 16 | |---|---|---| |
| 17 | | `query(entity)` | single entity string | dict with type, name, associations | |
| 18 | | `query_batch(entities)` | list of entity strings | list[dict] | |
| 19 | | `summarize(result)` | query result dict | compact one-line text | |
| 20 | | `get_target_info(ensembl_id)` | Ensembl ID string | raw GraphQL response | |
| 21 | | `get_drug_info(chembl_id)` | ChEMBL ID string | raw GraphQL response | |
| 22 | | `search_entities(term)` | free-text string | raw GraphQL response | |
| 23 | |
| 24 | ## Return Format |
| 25 | |
| 26 | **Target result:** |
| 27 | ```json |
| 28 | {"entity": "ENSG00000146648", "type": "target", "found": true, |
| 29 | "symbol": "EGFR", "name": "epidermal growth factor receptor", |
| 30 | "biotype": "protein_coding", |
| 31 | "top_diseases": [{"disease": "lung carcinoma", "score": 0.78}]} |
| 32 | ``` |
| 33 | |
| 34 | **Drug result:** |
| 35 | ```json |
| 36 | {"entity": "CHEMBL941", "type": "drug", "found": true, |
| 37 | "name": "IMATINIB", "drug_type": "Small molecule", |
| 38 | "max_phase": 4, |
| 39 | "indications": [{"disease": "chronic myeloid leukemia", "phase": 4}]} |
| 40 | ``` |
| 41 | |
| 42 | **Search result:** |
| 43 | ```json |
| 44 | {"entity": "BRCA1", "type": "search", "found": true, |
| 45 | "hits": [{"id": "ENSG00000012048", "name": "BRCA1", "entity_type": "target"}]} |
| 46 | ``` |
| 47 | |
| 48 | ## Usage |
| 49 | |
| 50 | 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. |
| 51 | |
| 52 | ## Source |
| 53 | |
| 54 | - **Endpoint**: `https://api.platform.opentargets.org/api/v4/graphql` |
| 55 | - **Docs**: https://platform.opentargets.org/ |
| 56 | - **Paper**: https://doi.org/10.1093/nar/gkac1046 |