PrimeKG knowledge graph
Queries a pinned PrimeKG CSV for gene, drug, disease and phenotype nodes, their associations and one- or two-hop paths, keeping relation meaning and provenance intact. Use when reproducing PrimeKG work or generating hypotheses from it.
primekg- Author
- K-Dense
- Source
- K-Dense-AI/scientific-agent-skills/skills/primekg @ ec59a29
- License
- Unknown in the skill, MIT for the repository
About this skill
What it does
The skill queries PrimeKG, the Harvard precision-medicine knowledge graph, from the published CSV on disk. The agent first pins the artifact: dataset DOI 10.7910/DVN/IXA7BM, version V2.1 from 2022, the Dataverse file id and provider MD5 of the 982 MB kg.csv, recorded with every result. Then it resolves an entity before traversing anything: a node is identified by the triple (id, type, source), and a bare id matching several release indexes is refused rather than guessed. From there come direct associations, a disease summary and one- or two-hop undirected paths.
Most of the text protects the meaning of the data. The CSV holds reverse rows, so row counts are not relationship counts and evidence must not be multiplied by duplicates; stored x/y order is not a direction of action; x_source and y_source name namespaces, not studies. A relation table says what each label does and does not mean: disease_protein is an association, not a causal gene; contraindication never counts as treatment support; disease_phenotype_negative keeps its sign, and a missing edge means unknown. The phenotype node type is effect/phenotype, and no generic drug_disease or gwas relation exists to assume.
scripts/query_primekg.py provides search_nodes, get_neighbors, get_disease_context and find_paths. It is a pandas reader over the pinned file — the whole CSV per query, so the skill tells you to build an index for repeated work — and makes no network calls. references/data-contract.md holds the Dataverse metadata calls, checksum verification and how kg.csv, kg_grouped.csv, the feature files and the PyTDC route differ.
When to use it, and when not
Use it to reproduce a PrimeKG analysis, resolve gene, drug, disease or phenotype entities in one pinned release, or generate hypotheses from recorded associations with their provenance intact.
It is not a live biomedical API and not an OptimusKG client, which upstream now recommends for new work. A path is a hypothesis: the skill is explicit that it establishes no causality, efficacy or clinical conclusion.
How to run it
We do not copy this skill: it declares its licence as Unknown, which does not match the repository's MIT. Install it from K-Dense's repository with the button to the source: gh skill install K-Dense-AI/scientific-agent-skills primekg for one skill, npx skills add K-Dense-AI/scientific-agent-skills for the set, or the whole repository as an Agent Plugins package for Cursor and Codex, where the skill may show under the scientific-agent-skills prefix. You need Python 3.11+ with pandas, several GB of free RAM, and the downloaded CSV, whose path goes in PRIMEKG_DATA (default data/PrimeKG/kg.csv). No credentials: the Dataverse record is public CC0.
- Claude Code:
/primekg, or ask for the skill by name. - Codex:
$primekg. - Cursor: type
/in the Agent chat and pickprimekg.
Example: /primekg Find the Alzheimer disease node in the pinned kg.csv, list its indication and contraindication edges, then show two-hop paths to APOE.
How it differs from similar skills
Nothing else in our catalog queries a biomedical knowledge graph, so there is no close comparison. The other K-Dense pages work on sequences and trees: Glycoengineering, Phylogenetics workflows and ETE Toolkit for phylogenetic trees.
Install
This skill is not copied to the catalog. Install it from the author's repository.
Connect through AnyModel API
This skill runs on whatever model your agent uses. Point Claude Code, Codex or Cursor at AnyModel to run it on Claude, GPT, Gemini and more with one key — pay per token, no subscription.
AnyModel