Skip to content
Back to skills

Pharmkg

ASecurity

Query 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 relationships derived from literature and curated databases.

  • 230 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 6, 2026
ai-agentsapidatabase

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add BioTender-max/awesome-bio-agent-skills --skill pharmkg --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pharmkg?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pharmkg
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/biotender-max-pharmkg/badge)](https://www.skillsdirectory.com/skills/biotender-max-pharmkg)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pharmkg-query
description: >
  Query 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 relationships derived from literature and curated databases.
---

# PharmKG Query Skill

Search PharmKG triples by entity name. Matching is case-insensitive; exact match
is tried first via a prebuilt index, with substring fallback.

| Input Example | Matches On |
|---|---|
| `aspirin` | exact on Entity1\_name or Entity2\_name |
| `BRCA1` | exact / substring on entity names |
| `Alzheimer Disease` | substring on entity names |

## Entity & Relation Types

**Entities** (~188 k): Drug/Chemical (DrugBank, ChEMBL), Gene/Protein (Entrez, UniProt), Disease (DO, MeSH).

**Relations** (39 types): chemical–gene (inhibition, activation, binding …), chemical–disease (treatment, marker, risk factor), gene–disease (association, marker), chemical–chemical (similarity, interaction), and others.

## API

| Function | Input | Returns |
|---|---|---|
| `load_pharmkg(path)` | CSV path | `list[dict]` of triples |
| `_build_index(triples)` | triple list | `dict[str, list]` (entity→triples) |
| `search(triples, entity, index=)` | entity string | `list[dict]` |
| `search_batch(triples, entities, index=)` | list of strings | `dict[str, list]` |
| `summarize(hits, entity)` | hits + label | compact text |
| `to_json(hits)` | hits | JSON string |

## Usage

See `if __name__ == "__main__"` block in `55_PharmKG.py` for runnable examples
covering: single entity search, batch search, summarize, and JSON output.

## Data

- **Source**: `raw_PharmKG-180k.csv` (comma-separated)
- **Columns**: `Entity1_name`, `relationship_type`, `Entity2_name`
- **Scale**: ~188 k entities, 39 relation types, >1 M triples
- **Path**: `DATA_PATH` variable in `55_PharmKG.py`
- **Paper**: Zheng et al., *Briefings in Bioinformatics* 22(4), 2021. DOI: 10.1093/bib/bbaa344

Files in this skill

  • README.md1.7 KB
  • SKILL.md2 KB
  • __init__.py134 B
  • example.py5.8 KB
  • pharmkg_skill.py4.3 KB
  • retrieve.py832 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.