Client library for loading the OptimusKG biomedical knowledge graph from Harvard Dataverse.
Project description
optimuskg
Python client for loading the OptimusKG biomedical knowledge graph from Harvard Dataverse.
Install
pip install optimuskg
Usage
import optimuskg
# Fetch any file from the gold parquet folder by relative path.
# First call downloads from Dataverse and caches locally; subsequent calls reuse the cache.
path = optimuskg.get_file("nodes/gene.parquet")
# Load a single file as a Polars DataFrame.
drugs = optimuskg.load_parquet("nodes/drug.parquet")
# Load the full graph (or the largest connected component) as two Polars DataFrames.
nodes, edges = optimuskg.load_graph(lcc=True)
# Load the graph as a NetworkX MultiDiGraph with JSON properties parsed onto nodes/edges.
G = optimuskg.load_networkx(lcc=True)
Configuration
Downloads are cached in platformdirs.user_cache_dir("optimuskg") by default (~/Library/Caches/optimuskg on macOS, ~/.cache/optimuskg on Linux). Override with $OPTIMUSKG_CACHE_DIR or optimuskg.set_cache_dir(path).
To point at a different dataset (e.g. a pre-release), set $OPTIMUSKG_DOI or call optimuskg.set_doi("doi:10.xxxx/XXXX").
TODO: the baked-in DOI (
doi:10.7910/DVN/IXA7BM) is a stub. Update it to the published DOI after the Dataverse release is live, and verify thatoptimuskg.load_graph(lcc=True)resolves without a 404.
License
MIT — see LICENSE. Use of the OptimusKG dataset itself is subject to the licenses of the constituent data sources; see the project license docs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file optimuskg-0.1.0.tar.gz.
File metadata
- Download URL: optimuskg-0.1.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f5bf044f23f7695e978a13b9d0b83df25a03ee45f25e88e8ce108d46f51a78
|
|
| MD5 |
1fa03e46bcb27f844f4b451c6bf90962
|
|
| BLAKE2b-256 |
6160a471808e87cc5b97b69608871e7850422eaca9e27c89e9a7a348b360a0ce
|
File details
Details for the file optimuskg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: optimuskg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efd94af29cd6265de8f79e545ae03bc02b4d50f921acb3fc521fe4a05c144ebb
|
|
| MD5 |
e708006d5619a77e756009c62e1a79e3
|
|
| BLAKE2b-256 |
18ecde6a6d427f243b9af3f44a38e6cc3e17d9d61c338a1d7a7aa2ee26131e62
|