Skip to content

Commit 9bb872d

Browse files
deeenesclaude
andcommitted
Add lookup() / related() high-level helpers and fresh() cache scope
Two new wrappers fold the common four-step pattern (resolve → relations → entities → join) into single calls. Both accept friendly id_type aliases (``name``, ``chebi``, ``hmdb``, ``uniprot``, …) and pivot the matching identifiers into named columns; ``related()`` does the subject + object join and exposes filters by sources, predicates, relation_categories, and participant_types (also aliased: ``protein``, ``small_molecule``, …). Multi-valued aliases pick the shortest representative. Also adds ``cache_clear()`` and a ``fresh()`` context manager: any URL+payload first-touched inside the block is re-downloaded; later identical requests in the same scope hit the freshly populated cache. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 20741d5 commit 9bb872d

4 files changed

Lines changed: 683 additions & 3 deletions

File tree

omnipath_client/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,28 @@
3333
'endpoints',
3434
'params',
3535
'values',
36+
'lookup',
37+
'related',
38+
'cache_clear',
39+
'fresh',
3640
]
3741

3842
from omnipath_client import cosmos, utils
3943
from ._client import (
4044
OmniPath,
45+
fresh,
46+
lookup,
4147
params,
4248
values,
49+
related,
4350
entities,
4451
resolve,
4552
endpoints,
4653
relations,
4754
resources,
4855
annotations,
4956
ontologies,
57+
cache_clear,
5058
search_terms,
5159
ontology_tree,
5260
ontology_terms,

0 commit comments

Comments
 (0)