OptimusKG
OptimusKG Client

Reference

Autogenerated API reference for the optimuskg Python client.

Client for the OptimusKG biomedical knowledge graph on Harvard Dataverse.

attribute__version__
= '0.1.0'
attribute__all__
= ['__version__', 'get_cache_dir', 'get_doi', 'get_file', 'get_server', 'load_graph', 'load_networkx', 'load_parquet', 'set_cache_dir', 'set_doi', 'set_server']
attributeDEFAULT_SERVER
= 'https://dataverse.harvard.edu'
attributeDEFAULT_DOI
= 'doi:10.7910/DVN/IYNGEV'
funcget_file(relative_path, *, force=False) -> Path

Return the local path to a parquet file, downloading from Dataverse if missing.

Paths mirror the layout under data/gold/kg/parquet/ in the source repo.

paramrelative_pathstr
paramforcebool
= False

Returns

pathlib.Path
funcload_parquet(relative_path, *, force=False, **read_parquet_kwargs) -> pl.DataFrame

Download (if needed) and read a parquet file as a Polars DataFrame.

paramrelative_pathstr
paramforcebool
= False
paramread_parquet_kwargsAny
= {}

Returns

polars.polars.DataFrame
funcload_graph(*, lcc=False, force=False) -> tuple[pl.DataFrame, pl.DataFrame]

Return (nodes, edges) Polars DataFrames for the full graph or its LCC.

paramlccbool
= False
paramforcebool
= False

Returns

tuple[polars.polars.DataFrame, polars.polars.DataFrame]
funcload_networkx(*, lcc=False, force=False, parse_properties=True) -> nx.MultiDiGraph

Return the graph as a nx.MultiDiGraph with properties loaded onto attrs.

paramlccbool
= False
paramforcebool
= False
paramparse_propertiesbool
= True

Returns

networkx.networkx.MultiDiGraph
funcget_server() -> str

Return the Dataverse server URL.

Returns

str
funcset_server(url) -> None

Override the Dataverse server URL for the current process.

paramurlstr

Returns

None
funcget_doi() -> str

Return the persistent identifier for the OptimusKG dataset.

Returns

str
funcset_doi(doi) -> None

Override the dataset DOI for the current process.

paramdoistr

Returns

None
funcget_cache_dir() -> Path

Return the root directory where downloaded files are cached.

Returns

pathlib.Path
funcset_cache_dir(path) -> None

Override the local cache directory for the current process.

parampathstr | os.PathLike[str]

Returns

None