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