# PrimeKG: a knowledge graph of disease, gene and drug

> PrimeKG integrates twenty biomedical resources into a graph of 17,080 diseases and 4,050,249 relationships across ten biological scales, published as a CSV and as a set of construction scripts. The README now opens by recommending its successor, OptimusKG, because that dataset is a superset with more current data.

**mims-harvard/PrimeKG** — Precision Medicine Knowledge Graph (PrimeKG)

- Repository: https://github.com/mims-harvard/PrimeKG
- Website: https://zitniklab.hms.harvard.edu/projects/PrimeKG
- Stars: 836 · Forks: 162
- Language: Jupyter Notebook
- License: MIT
- Published: 2026-10-20 · Updated: 2026-10-20 · Language: en
- Canonical page: https://hysenlabs.com/projects/mims-harvard-primekg

## The graph, in the numbers the README leads with

PrimeKG, the Precision Medicine Knowledge Graph, presents a combined view of diseases, and the summary paragraph gives the scale directly. It integrates 20 high-quality biomedical resources to describe 17,080 diseases with 4,050,249 relationships representing ten major biological scales.

Ten scales is the part that determines whether the graph is useful to you, because it decides what kinds of node can be connected to what. A graph that links diseases to genes and to drugs is a different tool from one that also carries anatomical structures, pathways, phenotypes and the mechanisms of a side effect.

The second half of the design is the part that is easy to miss. PrimeKG's graph structure is accompanied by text descriptions of clinical guidelines for drugs and diseases, to enable multimodal analyses. So the resource is not only a graph, it is a graph paired with prose, and the pairing is what lets a model work over the text and the structure together.

The project comes from the Zitnik lab at Harvard Medical School, with a lab site for PrimeKG, a Nature publication, and the dataset published on Harvard Dataverse. The licence is MIT, the primary language of the repository is Jupyter Notebook, and there are no GitHub releases, so the CSV on Dataverse and the notebooks in the repository are the two artefacts anyone actually uses. The last push was on 2026-06-30.

The README's advice is that you can get started by downloading the CSV file, and for most users that is correct: a multi-million edge graph is not something you want to rebuild before you know whether it answers your question.

## The first note in the README is a recommendation to use something else

The most useful thing in this README is the notice at the very top, and it is a recommendation to move on.

PrimeKG has been superseded by OptimusKG. Since OptimusKG contains a superset of PrimeKG's information, along with more up-to-date data, it is recommended to use OptimusKG instead of PrimeKG in almost every case. The notice links the successor's site, the OptimusKG code on GitHub, the dataset on Harvard Dataverse with a persistent identifier, and a Python client on PyPI.

That is a well-handled handover, and three things about it are worth noting. First, the successor is not a closed service: the code, the dataset and a client are all public, and the client on PyPI means you can fetch the data programmatically rather than downloading a file by hand. Second, the notice tells you what the relationship between the two is, a superset with fresher data, so you can reason about which one your published results should be based on. Third, the word almost is deliberate, so there is still a case for PrimeKG, and the obvious one is that a paper or a benchmark already written against it depends on its contents.

So the practical reading of this repository today is that it is the historical version of a resource that has moved on, kept online because the older dataset is still cited, with the construction scripts retained so that a graph can be rebuilt.

## The December 2023 OMIM extension, in counts

The news section records two updates, and the more recent one is the more interesting.

In December 2023, an updated version of PrimeKG including complete entries from the Online Mendelian Inheritance in Man database in a standardized data format was prepared. The reason is given in issue 9, that OMIM phenotypes and genes were not fully included in prior versions of PrimeKG, and the fix is the pull request that adds them.

The engineering behind it is a decision about format. The team devised a standardized data format, developed in pull request 207 of the related Therapeutics Data Commons repository, that is used for all data sources in the same format as the published PrimeKG edge list. In other words, a new source is not a special case, it is another run of the standard pipeline, which is the property that makes a graph like this extensible at all.

The scripts that came with it are named in the README: a processing script for OMIM data, a folder for the OMIM datasets, a notebook that wraps the OMIM API to download entries, and a notebook that appends those entries to PrimeKG, plus shared utilities used across multiple data sources. The API wrapper needs a key.

The edge additions were substantial, and they are given precisely:

```text
# of new edges: 612282
# of new node: 32866
```

and by relation type:

```text
relation
mim_disease                        9599
mim_gene                          16636
mim_phenotype                    574128
mim_phenotypic_series              4111
mim_phenotypic_series_disease       549
phenotype_map                      7259
```

The new links join OMIM genes to NCBI Gene entries, add HPO to OMIM edges, and add MONDO to OMIM edges, which is how a phenotype in one vocabulary gets connected to the disease and gene in another.

## The July 2023 rebuild, and why the published files stayed put

The earlier update is the one that explains how the scripts and the data relate, and the distinction matters more than the changelog entry suggests.

In July 2023 the repository was updated to rebuild PrimeKG and include database releases up to that month. The files published on Harvard Dataverse remain unchanged, however, new scripts and updated links are provided should users wish to build their own current version. So there are two things called PrimeKG: the frozen published artefact, and a construction pipeline that can produce a fresher one.

The rebuild re-ran or updated 17 scripts in the processing scripts directory, while the feature construction scripts may remain out of date. The sources that were re-run include Bgee, the Comparative Toxicogenomics Database, DisGeNET, DrugBank, DrugCentral, NCBI Gene, the Gene Ontology, the Human Phenotype Ontology, MONDO, Reactome, SIDER, UBERON and UMLS, and the entry point is the primary data resources shell script, which was created to automatically create the directory structure, pull the data and run the processing and feature extraction steps.

The individual entries are the kind of detail you only learn by reading them. The environment construction script was broken and was fixed. A new step retrieves gene names, details and the NCBI identifier to UniProt identifier mapping from genenames.org and writes them to the vocabulary directory as gene_names.csv and gene_map.csv. In Bgee, a specific set of gold quality calls, those with an expression rank below 25000, now carry a cell type in a particular tissue, and those rows are dropped in the Bgee script. The Comparative Toxicogenomics Database URL was updated. DisGeNET needed no changes. And DrugBank had broken paths fixed.

Read together, they describe a pipeline that is maintained rather than finished, which is the honest character of a resource that integrates twenty upstream databases.

## The repository is a pipeline, not a library

The top-level listing shows what kind of project this is, and it is a data pipeline with a published output rather than a piece of software anyone imports.

There is a datasets/ directory holding the source data and the processing scripts, a knowledge_graph/ directory with the notebooks that assemble the graph, and a scripts/ directory with the shared utilities. There is a case_study/ directory, which is where the analyses that justify the graph live, and a fig/ directory for the figures those analyses produce.

The environment is spread across three files, and that is where the friction is. There is an environment.yml, which is the conda environment definition, a setup.sh, a setup_jupyter.sh for the notebook environment, and two requirements files, requirements.txt and updated_requirements.txt.

The distinction between those two requirements files is the interesting one, because the contents of the older one are a trap. It pins versions with local file references, pointing at conda build directories and temporary paths on the machine of whoever generated it, with entries like an attributes package referenced from a conda build path and a bcrypt package referenced from a user directory under Users. Those paths do not exist on your machine, so the file cannot be installed as it stands. The updated_requirements.txt is the one to look at first.

The notebook-first layout is also the reason the primary language of the repository is recorded as Jupyter Notebook. The knowledge graph is assembled and the analysis is done in notebooks, and the scripts are the part that gets versioned and run.

## What to do if you are picking this up today

Three practical decisions, in the order you will face them.

The first is PrimeKG or OptimusKG. The README's own answer is OptimusKG in almost every case, because it is a superset with more current data, and it comes with a Python client, which removes the need to download and parse a large file yourself. Choose PrimeKG only when you need the historical contents, for example because an existing result is based on it.

The second is whether you want the artefact or the pipeline. The CSV on Harvard Dataverse is the artefact, it is citable with a persistent identifier, and it is the fast way to find out whether the graph answers your question. The pipeline is what you need if you want current upstream data, and it comes with a cost: twenty source databases, an API key for OMIM, and scripts that were last updated in 2023 against sources that have moved since.

The third is the environment. Start with the environment.yml and the updated requirements, not with the requirements file that carries the local build paths, and expect the rebuild to need the sources updated by hand when an upstream URL moves, which the July and December 2023 entries show happening repeatedly.

One last practical point. The MIT licence covers the repository, and the graph is published as a dataset with its own citation on Harvard Dataverse, so a project that uses the graph should cite the Nature paper rather than the repository, and should say which of the two graphs it used.

## Conclusion

Use PrimeKG when you need a citable, downloadable knowledge graph for precision medicine work and want the CSV rather than a pipeline, since the published file is the artefact most projects actually consume. Do not start new work on PrimeKG when OptimusKG will do, because the README says OptimusKG is a superset with more up-to-date data and recommends it in almost every case. Before you rebuild the graph from source, read the environment files, because the pinned requirements point at local conda build directories that will not resolve on your machine, and check which upstream sources have moved since the scripts were last updated in 2023.

## FAQ

### What is PrimeKG and how large is it?

The Precision Medicine Knowledge Graph, which integrates 20 biomedical resources to describe 17,080 diseases with 4,050,249 relationships across ten biological scales, and pairs the graph with text descriptions of clinical guidelines for drugs and diseases to enable multimodal analysis.

### Should I use PrimeKG or OptimusKG?

The README recommends OptimusKG in almost every case, because it contains a superset of PrimeKG's information with more up-to-date data, and it offers a public code repository, a dataset on Harvard Dataverse and a Python client on PyPI. PrimeKG remains useful when you need the historical contents that existing work was based on.

### How do I get the PrimeKG data?

The fastest route is the CSV file published on Harvard Dataverse, which the README suggests for getting started. To rebuild a current version yourself, the repository provides construction scripts and a primary data resources script that pulls the twenty sources and runs the processing steps, with scripts for building OMIM entries and appending them to the graph.

### What did the December 2023 update of PrimeKG add?

Complete OMIM entries in a standardized data format, with 612,282 new edges and 32,866 new nodes. The new links join OMIM genes to NCBI Gene entries and add HPO to OMIM and MONDO to OMIM edges, using a standardized format developed in pull request 207 of the Therapeutics Data Commons repository so that every source is processed the same way.

## Sources

- [Issues](https://github.com/mims-harvard/PrimeKG/issues)
- [License: MIT](https://github.com/mims-harvard/PrimeKG/blob/main/LICENSE)
- [mims-harvard/PrimeKG on GitHub](https://github.com/mims-harvard/PrimeKG)
- [Project website](https://zitniklab.hms.harvard.edu/projects/PrimeKG)
- [README](https://github.com/mims-harvard/PrimeKG/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/mims-harvard-primekg
