| name | primekg |
| description | Query the Precision Medicine Knowledge Graph (PrimeKG) for multiscale biological relationships across genes and proteins, drugs, diseases, phenotypes, pathways, biological processes, exposures and anatomy. Use this skill to search entities by name, pull direct neighbours and their evidence types, summarise the local network around a disease, and find direct or two-hop drug-disease connections for repurposing hypotheses. Also trigger on PrimeKG, kg.csv, Harvard Dataverse knowledge graph, disease_protein, drug_protein, indication and contraindication edges, or network pharmacology over a biomedical knowledge graph. |
| license | MIT |
| compatibility | Requires Python 3.10+ with pandas. Needs the PrimeKG edge list (kg.csv, roughly 4 million rows and several hundred MB) downloaded from Harvard Dataverse and pointed at with the PRIMEKG_DATA environment variable. No network access at query time; the whole graph is read into memory, so budget a few GB of RAM. |
| allowed-tools | Read Write Edit Bash |
| metadata | {"version":"1.3","skill-author":"K-Dense Inc. (PrimeKG original from Harvard MIMS)"} |
PrimeKG Knowledge Graph Skill
Overview
PrimeKG is a precision medicine knowledge graph that integrates 20 high-quality primary resources
into a single edge list. It describes 17,080 diseases with 4,050,249 relationships across ten
major biological scales — drug-target, disease-gene, phenotype-disease, pathway and anatomical
associations among them — over roughly 129,000 nodes.
Its distinguishing feature is drug-disease coverage: PrimeKG carries indication,
contraindication, and off-label use edges that most disease knowledge graphs lack, which is
what makes repurposing questions answerable here rather than merely askable.
Cite: Chandak P, Huang K, Zitnik M. Building a knowledge graph to enable precision medicine.
Sci Data 10, 67 (2023). PMID 36732524.
Key capabilities:
- Search for nodes (genes, proteins, drugs, diseases, phenotypes)
- Retrieve direct neighbors (associated entities and clinical evidence)
- Analyze local disease context (related genes, drugs, phenotypes)
- Identify drug-disease paths (potential repurposing opportunities)
Data access: scripts/query_primekg.py reads kg.csv from the path in the PRIMEKG_DATA
environment variable (default data/PrimeKG/kg.csv). Download the CSV first — see
Data Path. The script works as a CLI or as an importable module:
python skills/primekg/scripts/query_primekg.py search Alzheimer --node-type disease
python skills/primekg/scripts/query_primekg.py neighbors EFO_0000249 --relation disease_protein
python skills/primekg/scripts/query_primekg.py context "Alzheimer's disease"
python skills/primekg/scripts/query_primekg.py paths CHEMBL1 D001 --max-depth 2
Add --format json for machine-readable output, or --data /path/to/kg.csv to override
PRIMEKG_DATA for one run. Every subcommand exits non-zero when the data file is missing.
When to Use This Skill
This skill should be used when:
- Knowledge-based drug discovery: Identifying targets and mechanisms for diseases.
- Drug repurposing: Finding existing drugs that might have evidence for new indications.
- Phenotype analysis: Understanding how symptoms/phenotypes relate to diseases and genes.
- Multiscale biology: Bridging the gap between molecular targets (genes) and clinical outcomes (diseases).