alterlab-primekg

Installation
SKILL.md

PrimeKG Knowledge Graph Skill

Overview

PrimeKG (Chandak, Huang & Zitnik, Scientific Data 2023; mims-harvard/PrimeKG) is a precision medicine knowledge graph integrating 20 primary resources. It contains 129,375 nodes and 4,050,249 edges across 30 edge types and 10 node types, including drug-target, disease-gene, and disease-phenotype associations. The published Dataverse files are a fixed 2022 snapshot.

Superseded upstream. The PrimeKG maintainers now state that PrimeKG has been superseded by OptimusKG (same lab; a superset with more current data — 190,531 nodes, 21.8M edges, 26 relation types) and recommend it for almost all new work. Use OptimusKG for new analyses (uv pip install optimuskg, Python ≥ 3.12; import optimuskg; nodes, edges = optimuskg.load_graph(lcc=True) or G = optimuskg.load_networkx(lcc=True); data: Harvard Dataverse doi:10.7910/DVN/IYNGEV, docs: https://optimuskg.ai). Keep this PrimeKG workflow for reproducing or comparing against published PrimeKG results and benchmarks.

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: Programmatic access via scripts/query_primekg.py. Point the loader at the kg.csv released on Harvard Dataverse via the PRIMEKG_DATA_PATH environment variable (it defaults to ../data/kg.csv relative to the script). All functions operate on the x_*/y_*/relation/display_relation columns of kg.csv.

When to Use This Skill

This skill should be used when:

Installs
65
GitHub Stars
75
First Seen
Apr 12, 2026