$npx -y skills add QSong-github/DrugClaw --skill pharmkgQuery the PharmKG knowledge graph (180k entities, 39 relation types, >1M triples). Use whenever the user asks about biomedical relationships among genes, drugs/chemicals, and diseases — e.g. drug–gene interactions, drug–disease associations, gene–disease links, or drug–drug relat
| 1 | # PharmKG Query Skill |
| 2 | |
| 3 | Search PharmKG triples by entity name. Matching is case-insensitive; exact match |
| 4 | is tried first via a prebuilt index, with substring fallback. |
| 5 | |
| 6 | | Input Example | Matches On | |
| 7 | |---|---| |
| 8 | | `aspirin` | exact on Entity1\_name or Entity2\_name | |
| 9 | | `BRCA1` | exact / substring on entity names | |
| 10 | | `Alzheimer Disease` | substring on entity names | |
| 11 | |
| 12 | ## Entity & Relation Types |
| 13 | |
| 14 | **Entities** (~188 k): Drug/Chemical (DrugBank, ChEMBL), Gene/Protein (Entrez, UniProt), Disease (DO, MeSH). |
| 15 | |
| 16 | **Relations** (39 types): chemical–gene (inhibition, activation, binding …), chemical–disease (treatment, marker, risk factor), gene–disease (association, marker), chemical–chemical (similarity, interaction), and others. |
| 17 | |
| 18 | ## API |
| 19 | |
| 20 | | Function | Input | Returns | |
| 21 | |---|---|---| |
| 22 | | `load_pharmkg(path)` | CSV path | `list[dict]` of triples | |
| 23 | | `_build_index(triples)` | triple list | `dict[str, list]` (entity→triples) | |
| 24 | | `search(triples, entity, index=)` | entity string | `list[dict]` | |
| 25 | | `search_batch(triples, entities, index=)` | list of strings | `dict[str, list]` | |
| 26 | | `summarize(hits, entity)` | hits + label | compact text | |
| 27 | | `to_json(hits)` | hits | JSON string | |
| 28 | |
| 29 | ## Usage |
| 30 | |
| 31 | See `if __name__ == "__main__"` block in `55_PharmKG.py` for runnable examples |
| 32 | covering: single entity search, batch search, summarize, and JSON output. |
| 33 | |
| 34 | ## Data |
| 35 | |
| 36 | - **Source**: `raw_PharmKG-180k.csv` (comma-separated) |
| 37 | - **Columns**: `Entity1_name`, `relationship_type`, `Entity2_name` |
| 38 | - **Scale**: ~188 k entities, 39 relation types, >1 M triples |
| 39 | - **Path**: `DATA_PATH` variable in `55_PharmKG.py` |
| 40 | - **Paper**: Zheng et al., *Briefings in Bioinformatics* 22(4), 2021. DOI: 10.1093/bib/bbaa344 |