Skip to main content

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 that optimuskg.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optimuskg-0.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

optimuskg-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

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

Hashes for optimuskg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51f5bf044f23f7695e978a13b9d0b83df25a03ee45f25e88e8ce108d46f51a78
MD5 1fa03e46bcb27f844f4b451c6bf90962
BLAKE2b-256 6160a471808e87cc5b97b69608871e7850422eaca9e27c89e9a7a348b360a0ce

See more details on using hashes here.

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

Hashes for optimuskg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efd94af29cd6265de8f79e545ae03bc02b4d50f921acb3fc521fe4a05c144ebb
MD5 e708006d5619a77e756009c62e1a79e3
BLAKE2b-256 18ecde6a6d427f243b9af3f44a38e6cc3e17d9d61c338a1d7a7aa2ee26131e62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page