$npx -y skills add QSong-github/DrugClaw --skill kegg_drug> Approved drugs — structures, targets, pathways & drug-drug interactions > Category: Drug-centric | Type: DB | Subcategory: DDI > API: https://rest.kegg.jp (free, no key required for academic use)
| 1 | # 68 · KEGG Drug |
| 2 | |
| 3 | > Approved drugs — structures, targets, pathways & drug-drug interactions |
| 4 | > **Category:** Drug-centric | **Type:** DB | **Subcategory:** DDI |
| 5 | > **API:** `https://rest.kegg.jp` (free, no key required for academic use) |
| 6 | |
| 7 | | Resource | URL | |
| 8 | |----------|-----| |
| 9 | | Homepage | https://www.genome.jp/kegg/ | |
| 10 | | API docs | https://www.kegg.jp/kegg/docs/keggapi.html | |
| 11 | | Paper | https://academic.oup.com/nar/article/38/suppl_1/D355/3112250 | |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | ## What it provides |
| 16 | |
| 17 | - **Drug metadata**: name, formula, molecular weight, efficacy, class |
| 18 | - **Targets**: gene/protein targets for each approved drug |
| 19 | - **Interactions (DDI)**: drug-drug interaction annotations |
| 20 | - **Pathways**: linked KEGG pathway IDs |
| 21 | |
| 22 | --- |
| 23 | |
| 24 | ## Quick start |
| 25 | |
| 26 | ```python |
| 27 | from 68_KEGG_Drug import query |
| 28 | |
| 29 | # Single entity |
| 30 | results = query("aspirin") |
| 31 | |
| 32 | # Multiple entities |
| 33 | results = query(["aspirin", "metformin", "imatinib"]) |
| 34 | |
| 35 | # By KEGG Drug ID |
| 36 | results = query("D00109") |
| 37 | |
| 38 | # Specific fields only |
| 39 | results = query("warfarin", fields="targets") |
| 40 | results = query("warfarin", fields="interactions") |
| 41 | ``` |
| 42 | |
| 43 | --- |
| 44 | |
| 45 | ## `query()` interface |
| 46 | |
| 47 | ``` |
| 48 | query(entities, fields="all") -> list[dict] |
| 49 | ``` |
| 50 | |
| 51 | | Parameter | Type | Description | |
| 52 | |------------|--------------------|-------------| |
| 53 | | `entities` | `str \| list[str]` | Drug name(s) or KEGG Drug ID(s) (e.g. `"D00109"`) | |
| 54 | | `fields` | `str` | `"all"` — full entry; `"targets"` — targets only; `"interactions"` — DDI only | |
| 55 | |
| 56 | ### Return structure (`fields="all"`) |
| 57 | |
| 58 | ```json |
| 59 | [ |
| 60 | { |
| 61 | "drug_id": "dr:D00109", |
| 62 | "query": "aspirin", |
| 63 | "name": "Aspirin (JP18/USP/INN); ...", |
| 64 | "formula": "C9H8O4", |
| 65 | "mol_weight": "180.0423", |
| 66 | "targets": ["PTGS1 ...", "PTGS2 ..."], |
| 67 | "interactions": ["Warfarin [precaution] ...", ...], |
| 68 | "pathways": ["map07112 ...", ...], |
| 69 | "classes": ["Analgesic ...", ...] |
| 70 | } |
| 71 | ] |
| 72 | ``` |
| 73 | |
| 74 | If a name cannot be resolved, the entry contains `{"query": "xxx", "error": "No match found"}`. |
| 75 | |
| 76 | --- |
| 77 | |
| 78 | ## Lower-level functions |
| 79 | |
| 80 | | Function | Input | Output | Description | |
| 81 | |----------|-------|--------|-------------| |
| 82 | | `search(query, limit=10)` | drug name/keyword | `list[{id, name}]` | Keyword search | |
| 83 | | `get_entry(drug_id)` | KEGG Drug ID | `dict` | Full parsed entry | |
| 84 | | `get_targets(drug_id)` | KEGG Drug ID | `list[str]` | Target lines | |
| 85 | | `get_interactions(drug_id)` | KEGG Drug ID | `list[str]` | DDI lines | |
| 86 | |
| 87 | --- |
| 88 | |
| 89 | ## Notes |
| 90 | |
| 91 | - KEGG REST API is free for academic use; commercial use requires a license. |
| 92 | - Rate limit: no official cap, but keep requests reasonable (~1 req/sec). |
| 93 | - Drug IDs look like `D00109` or `dr:D00109`; both formats accepted. |
| 94 | - Not all drugs have interaction or target annotations — empty list means no data. |