$npx -y skills add QSong-github/DrugClaw --skill drugcentralQuery the DrugCentral drug pharmacology database. Use whenever the user asks about approved drug structures, drug targets, pharmacological actions, or wants to look up any entity (drug name, DrugCentral ID, CAS number, InChIKey) in DrugCentral.
| 1 | # DrugCentral Query Skill |
| 2 | |
| 3 | Search local DrugCentral flat files by any entity. Auto-detects query type: |
| 4 | |
| 5 | | Input Pattern | Detected As | Match Logic | |
| 6 | |---|---|---| |
| 7 | | `860` (numeric) | DrugCentral ID | exact on `ID` | |
| 8 | | `50-78-2` (NNN-NN-N) | CAS Number | exact on `CAS_RN` | |
| 9 | | `BSYNRYMUTXBXSQ` or full key | InChIKey (prefix or full) | prefix match on `InChIKey` | |
| 10 | | anything else | free text | substring on `INN` (drug name) | |
| 11 | |
| 12 | ## Data |
| 13 | |
| 14 | Download from <https://drugcentral.org/download>: |
| 15 | |
| 16 | | File | Description | Required | |
| 17 | |---|---|---| |
| 18 | | `structures.smiles.tsv` | SMILES, InChI, InChIKey, ID, INN, CAS_RN | **Yes** | |
| 19 | | `drug.target.interaction.tsv` | Drug-target interaction profiles (gene, action, potency) | Recommended | |
| 20 | | `FDA+EMA+PMDA_Approved.csv` | Approval status (ID, drug_name) | Optional | |
| 21 | |
| 22 | Place files in `DATA_DIR` (default: `resources_metadata/drug_knowledgebase/DrugCentral`, or set env `DRUGCENTRAL_DIR`). |
| 23 | |
| 24 | ## API |
| 25 | |
| 26 | | Function | Input | Returns | |
| 27 | |---|---|---| |
| 28 | | `search(entity)` | single entity string | `dict` with `structures`, `targets`, `approved` | |
| 29 | | `search_batch(entities)` | list or comma-separated string | `dict[str, dict]` | |
| 30 | | `summarize(result, entity)` | search result dict + label | compact text | |
| 31 | | `to_json(result)` | search result dict | JSON string | |
| 32 | |
| 33 | ## Key Fields |
| 34 | |
| 35 | **structures**: `ID`, `INN` (drug name), `CAS_RN`, `SMILES`, `InChI`, `InChIKey` |
| 36 | |
| 37 | **targets** (from DTI file): `GENE`, `TARGET_NAME`, `TARGET_CLASS`, `ACTION_TYPE`, `ACT_VALUE`, `ACT_TYPE`, `ACT_UNIT`, `ACCESSION` (UniProt), `TDL`, `ORGANISM` |
| 38 | |
| 39 | **approved**: `id`, `name`, `approved` (bool) |
| 40 | |
| 41 | ## Usage |
| 42 | |
| 43 | ```python |
| 44 | from 18_DrugCentral import search, search_batch, summarize, to_json |
| 45 | |
| 46 | # Single query — drug name |
| 47 | result = search("aspirin") |
| 48 | print(summarize(result)) |
| 49 | |
| 50 | # Single query — DrugCentral ID |
| 51 | result = search("860") |
| 52 | print(summarize(result)) |
| 53 | |
| 54 | # Single query — CAS number |
| 55 | result = search("50-78-2") |
| 56 | print(summarize(result)) |
| 57 | |
| 58 | # Batch query |
| 59 | results = search_batch(["metformin", "ibuprofen", "50-78-2"]) |
| 60 | for entity, res in results.items(): |
| 61 | print(summarize(res, entity)) |
| 62 | |
| 63 | # JSON export |
| 64 | print(to_json(result)) |
| 65 | ``` |
| 66 | |
| 67 | See `if __name__ == "__main__"` block in `18_DrugCentral.py` for runnable examples covering: drug name, DrugCentral ID, CAS number, InChIKey prefix, batch search, and JSON output. |
| 68 | |
| 69 | ## Source |
| 70 | |
| 71 | - **DrugCentral**: <https://drugcentral.org/> |
| 72 | - **Paper**: Avram et al., *Nucleic Acids Research* 2023, 51(D1):D1276–D1287. DOI: [10.1093/nar/gkac1085](https://doi.org/10.1093/nar/gkac1085) |
| 73 | - **License**: CC BY-NC 4.0 (non-commercial) |