Metadata-Version: 2.4
Name: optimuskg
Version: 0.1.0
Summary: Client library for loading the OptimusKG biomedical knowledge graph from Harvard Dataverse.
Project-URL: Homepage, https://optimuskg.ai
Project-URL: Repository, https://github.com/mims-harvard/optimuskg
Project-URL: Dataset, https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/IXA7BM
Author: Iñaki Arango, Lucas Vittor, Joaquín Poloneur, Ayush Noori, Marinka Zitnik
License: MIT License
        
        Copyright (c) 2025 Zitnik Lab, Department of Biomedical Informatics, Harvard Medical School
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: biomedical,dataverse,knowledge-graph,networkx,polars
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.12
Requires-Dist: networkx>=3.0
Requires-Dist: platformdirs>=4.0.0
Requires-Dist: polars>=1.19.0
Requires-Dist: pyarrow>=19.0.0
Requires-Dist: requests>=2.32.3
Description-Content-Type: text/markdown

# optimuskg

Python client for loading the [OptimusKG](https://optimuskg.ai) biomedical knowledge graph from [Harvard Dataverse](https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/IXA7BM).

## Install

```bash
pip install optimuskg
```

## Usage

```python
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](LICENSE). Use of the OptimusKG dataset itself is subject to the licenses of the constituent data sources; see the [project license docs](https://optimuskg.ai/docs/license).
