OpenParable
Skip to content
← Back to skills

Pharmkg Query

Research
pharmkg-query

Pharmkg Query is an Agent Skill for research published in the BioTender-max/awesome-bio-agent-skills repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

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.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/BioTender-max/awesome-bio-agent-skills/blob/HEAD/skills/drugclaw/pharmkg/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/pharmkg-query, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

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 ExampleMatches On
aspirinexact on Entity1_name or Entity2_name
BRCA1exact / substring on entity names
Alzheimer Diseasesubstring 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

FunctionInputReturns
load_pharmkg(path)CSV pathlist[dict] of triples
_build_index(triples)triple listdict[str, list] (entity→triples)
search(triples, entity, index=)entity stringlist[dict]
search_batch(triples, entities, index=)list of stringsdict[str, list]
summarize(hits, entity)hits + labelcompact text
to_json(hits)hitsJSON 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