
Optimuskg
- 10 installs
- 107 repo stars
- Updated August 3, 2026
- mims-harvard/optimuskg
Helps with ai & agent building tasks.
About
optimuskg is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- optimuskg
- AI & Agent Building
- AI-coding skill
Optimuskg by the numbers
- 10 all-time installs (skills.sh)
- +2 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #11,959 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mims-harvard/optimuskg --skill optimuskgAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 10 |
|---|---|
| repo stars | ★ 107 |
| Last updated | August 3, 2026 |
| Repository | mims-harvard/optimuskg ↗ |
What it does
Helps with ai & agent building tasks.
Files
OptimusKG
OptimusKG is a modern multimodal biomedical knowledge graph (190,531 nodes across 10 entity types, 21,813,816 edges across 27 relation types) integrating 65 resources grounded in 18 ontologies via the BioCypher framework and Biolink Model. It is published on Harvard Dataverse as Apache Parquet files and consumed through the optimuskg PyPI client.
This skill covers using the published graph via the client. It is not for developing the data pipeline in the mims-harvard/optimuskg repo — that work uses the repo's own /node-catalog-sync skill.
When to use
Use the optimuskg client when you need to:
- Download OptimusKG node/edge tables for analysis.
- Load the graph as Polars DataFrames or a NetworkX `MultiDiGraph`.
- Filter by entity type (Gene, Drug, Disease, …) or relation type.
- Build biomedical analyses, Graph-RAG, or ML over the graph.
Always prefer this client over hand-rolling Dataverse downloads — it resolves file IDs automatically and caches locally.
Installation
uv add optimuskg # in a uv project (preferred — see the `uv` skill)
pip install optimuskgThe client depends on polars (DataFrames) and networkx (graph view).
Quick start
import optimuskg
# Download a specific file; returns its local cached path
local_path = optimuskg.get_file("nodes/gene.parquet")
# Read a single Parquet file as a Polars DataFrame
drugs = optimuskg.load_parquet("nodes/drug.parquet")
# Load nodes + edges as Polars DataFrames (lcc=True -> largest connected component only)
nodes, edges = optimuskg.load_graph(lcc=True)
# Load as a NetworkX MultiDiGraph with properties merged onto node/edge attrs
G = optimuskg.load_networkx(lcc=True)Choosing the right loader
| Need | Function | Returns |
|---|---|---|
| Just the file on disk | get_file(path, *, force=False) | pathlib.Path |
| One table as a DataFrame | load_parquet(path, *, force=False, **read_parquet_kwargs) | pl.DataFrame |
| Whole graph as DataFrames | load_graph(*, lcc=False, force=False) | (nodes, edges) tuple of pl.DataFrame |
| Whole graph as NetworkX | load_networkx(*, lcc=False, force=False, parse_properties=True) | nx.MultiDiGraph |
Notes:
load_parquetforwards extra kwargs topl.read_parquet— e.g. push down
column selection: optimuskg.load_parquet("nodes/drug.parquet", columns=["id"]).
force=Truere-downloads even if the file is already cached.load_networkxalways builds aMultiDiGraphregardless of edge
directionality; call G.to_undirected() if you need an undirected view.
- Memory: loading the full graph into NetworkX needs several GB (190k
nodes, 21M edges) and emits a warning. Pass lcc=True for a smaller, connected variant unless you specifically need every node.
File paths
Paths mirror the catalog layout under data/gold/kg/parquet/ in the source repo:
optimuskg.get_file("nodes.parquet") # full nodes table
optimuskg.get_file("edges.parquet") # full edges table
optimuskg.get_file("largest_connected_component_nodes.parquet") # LCC nodes
optimuskg.get_file("largest_connected_component_edges.parquet") # LCC edges
optimuskg.get_file("nodes/gene.parquet") # only Gene (GEN) nodes
optimuskg.get_file("edges/disease_gene.parquet") # only DIS-GEN edgesnodes/<type>.parquet files use the lowercase entity name (gene, drug, …); edges/<a>_<b>.parquet files use the lowercase node pair (disease_gene, drug_gene, …).
Graph schema (at a glance)
Node table columns: id, label (the type code, e.g. GEN), properties. Edge table columns: from, to, label (e.g. DIS-GEN), relation (e.g. ASSOCIATED_WITH), undirected, properties.
In the unified nodes.parquet / edges.parquet tables, properties is a JSON string. In the stratified per-type files (nodes/<type>.parquet, edges/<label>.parquet) it is expanded into native typed columns as a Polars Struct.
The 10 node type codes:
| Label | Type | Label | Type | |
|---|---|---|---|---|
GEN | Gene | ANA | Anatomy | |
DIS | Disease | MFN | Molecular Function | |
BPO | Biological Process | CCO | Cellular Component | |
PHE | Phenotype | PWY | Pathway | |
DRG | Drug | EXP | Exposure |
For the full edge-label/relation taxonomy (all 27 edge types and their relation strings) and per-type property fields, see `reference/graph-schema.md`.
Common patterns
Filter Polars DataFrames by type/relation:
import polars as pl
nodes, edges = optimuskg.load_graph(lcc=True)
genes = nodes.filter(pl.col("label") == "GEN")
dis_gen = edges.filter(pl.col("relation") == "ASSOCIATED_WITH")Filter a NetworkX graph (properties are merged onto attrs):
G = optimuskg.load_networkx(lcc=True)
# Nodes by type code
genes = [n for n, a in G.nodes(data=True) if a["label"] == "GEN"]
# Edges by relation
expression = [
(u, v) for u, v, a in G.edges(data=True)
if a["relation"] == "EXPRESSION_PRESENT"
]Pass parse_properties=False to load_networkx to keep properties as a raw JSON string instead of merging parsed keys into the attribute dicts.
Configuration
The client targets doi:10.7910/DVN/IYNGEV on https://dataverse.harvard.edu by default, and caches downloads in platformdirs.user_cache_dir("optimuskg") (~/.cache/optimuskg on Linux, ~/Library/Caches/optimuskg on macOS). Cache keys include the dataset version, so a new release invalidates it automatically.
Override from code or via environment variables:
optimuskg.set_cache_dir("/data/optimuskg-cache")
optimuskg.set_doi("doi:10.7910/DVN/EXAMPLE") # target a different release
optimuskg.set_server("https://dataverse.example.org") # non-Harvard installation
# Read current settings
optimuskg.get_cache_dir(); optimuskg.get_doi(); optimuskg.get_server()export OPTIMUSKG_CACHE_DIR=/data/optimuskg-cache
export OPTIMUSKG_DOI=doi:10.7910/DVN/EXAMPLE
export OPTIMUSKG_SERVER=https://dataverse.example.orgCiting and license
- Cite OptimusKG when you use it in research — see
https://optimuskg.ai/docs/citation and the dataset DOI 10.7910/DVN/IYNGEV.
- License: the OptimusKG codebase is MIT. The integrated source datasets
keep their own licenses and terms of use, which may restrict redistribution or commercial use of a given graph subset — review each source's terms. See https://optimuskg.ai/docs/license.
Documentation
For full details (function signatures, per-type schemas, edge relations), read the official docs — they expose machine-readable text files:
- https://optimuskg.ai/llms.txt — index of all doc pages
- https://optimuskg.ai/llms-full.txt — full documentation in one file
- https://optimuskg.ai/docs/optimuskg-client/reference — API reference
- https://github.com/mims-harvard/optimuskg — source repository
OptimusKG graph schema reference
Full node-type and edge-type taxonomy for OptimusKG. Counts are from the published release (doi:10.7910/DVN/IYNGEV); use the type codes and relation strings below to filter the graph. For exact per-type property fields, see https://optimuskg.ai/docs/graph-schema/nodes and https://optimuskg.ai/docs/graph-schema/edges.
Base table columns
Nodes (nodes.parquet, largest_connected_component_nodes.parquet):
| Column | Type | Notes |
|---|---|---|
id | str | Stable node identifier |
label | str | Node type code (e.g. GEN) |
properties | JSON string | Per-type metadata; a Polars Struct in nodes/<type>.parquet |
Edges (edges.parquet, largest_connected_component_edges.parquet):
| Column | Type | Notes |
|---|---|---|
from | str | Source node id |
to | str | Target node id |
label | str | Edge type code (e.g. DIS-GEN) |
relation | str | Specific relation (e.g. ASSOCIATED_WITH) |
undirected | bool | Whether the edge is undirected |
properties | JSON string | A Polars Struct in edges/<label>.parquet |
In load_networkx, node label and edge relation are available on the attribute dict; properties keys are merged in unless parse_properties=False.
Node types (10)
| Label | Type | Count |
|---|---|---|
GEN | Gene | 61,306 |
DIS | Disease | 36,345 |
BPO | Biological Process | 25,754 |
PHE | Phenotype | 19,341 |
DRG | Drug | 16,766 |
ANA | Anatomy | 13,120 |
MFN | Molecular Function | 10,161 |
CCO | Cellular Component | 4,052 |
PWY | Pathway | 2,805 |
EXP | Exposure | 881 |
Edge types (27)
| Label | Relation(s) | Count |
|---|---|---|
DIS-GEN | ASSOCIATED_WITH | 9,734,774 |
ANA-GEN | EXPRESSION_PRESENT, EXPRESSION_ABSENT | 8,787,955 |
DRG-DRG | SYNERGISTIC_INTERACTION, PARENT | 1,345,376 |
PHE-GEN | ASSOCIATED_WITH | 793,279 |
GEN-GEN | INTERACTS_WITH | 327,924 |
BPO-GEN | INTERACTS_WITH | 158,410 |
DIS-PHE | PHENOTYPE_PRESENT | 157,144 |
CCO-GEN | INTERACTS_WITH | 105,309 |
MFN-GEN | INTERACTS_WITH | 90,933 |
DRG-DIS | INDICATION, CONTRAINDICATION, OFF_LABEL_USE | 70,380 |
PWY-GEN | INTERACTS_WITH | 46,977 |
BPO-BPO | IS_A | 44,494 |
DIS-DIS | PARENT | 44,215 |
PHE-PHE | PARENT | 24,862 |
DRG-GEN | ACTIVATOR, AGONIST, ALLOSTERIC_ANTAGONIST, ANTAGONIST, BINDING_AGENT, BLOCKER, CARRIER, DEGRADER, ENZYME, INHIBITOR, INVERSE_AGONIST, MODULATOR, NEGATIVE_ALLOSTERIC_MODULATOR, NEGATIVE_MODULATOR, OPENER, PARTIAL_AGONIST, POSITIVE_ALLOSTERIC_MODULATOR, POSITIVE_MODULATOR, RELEASING_AGENT, STABILISER, SUBSTRATE, TARGET, TRANSPORTER | 20,694 |
ANA-ANA | PARENT | 17,082 |
DRG-PHE | ADVERSE_DRUG_REACTION, ASSOCIATED_WITH, CONTRAINDICATION, INDICATION, OFF_LABEL_USE | 13,758 |
MFN-MFN | IS_A | 12,587 |
CCO-CCO | IS_A | 4,639 |
EXP-GEN | INTERACTS_WITH | 2,989 |
PWY-PWY | PARENT | 2,819 |
EXP-EXP | PARENT | 2,443 |
EXP-DIS | LINKED_TO | 2,391 |
EXP-BPO | INTERACTS_WITH | 2,260 |
EXP-MFN | INTERACTS_WITH | 47 |
EXP-CCO | INTERACTS_WITH | 13 |
DRG-BPO | INDICATION | 62 |
Stratified per-type files use lowercase, underscore-joined names derived from the full node-type names — e.g. DIS-GEN → edges/disease_gene.parquet, ANA-GEN → edges/anatomy_gene.parquet, DRG-DRG → edges/drug_drug.parquet.