@@ -12,16 +12,24 @@ prior-knowledge web API.
1212
1313## Features
1414
15- - Export ** entities** , ** interactions** , and ** associations** (complexes,
16- pathways, reactions) as DataFrames
15+ - One-call ** ` lookup() ` ** and ** ` related() ` ** helpers that resolve
16+ free-text queries, fetch the matching entities/relations, and pivot
17+ identifiers into named columns — no manual primary-key juggling
18+ - Friendly id-type aliases (` name ` , ` chebi ` , ` hmdb ` , ` uniprot ` ,
19+ ` genesymbol ` , ` kegg ` , …) and participant-type aliases
20+ (` protein ` , ` small_molecule ` , …) that hide the MI/OM ontology codes
21+ - Lower-level primitives: export ** entities** , ** relations** , and
22+ ** annotations** as DataFrames; resolve free-text identifiers; slice
23+ with paging
1724- ** Ontology** term lookup, search, and hierarchy trees
1825- Multi-backend output: [ polars] ( https://pola.rs/ ) (default),
1926 [ pandas] ( https://pandas.pydata.org/ ) , or
2027 [ pyarrow] ( https://arrow.apache.org/docs/python/ )
2128- Optional graph conversion to [ annnet] ( https://github.com/saezlab/annnet )
2229 objects
2330- Query validation against the API schema
24- - Caching via [ download-manager] ( https://github.com/saezlab/download-manager )
31+ - Caching via [ download-manager] ( https://github.com/saezlab/download-manager ) ,
32+ with a ` fresh() ` context manager for first-touch refresh
2533
2634## Installation
2735
@@ -37,20 +45,57 @@ pip install omnipath-client polars
3745
3846## Quick start
3947
48+ The two high-level helpers, ` lookup() ` and ` related() ` , cover most use
49+ cases in a single call:
50+
4051``` python
4152import omnipath_client as op
4253
43- # All interactions as a polars DataFrame
44- df = op.interactions()
54+ # Resolve names and pivot identifiers into named columns
55+ op.lookup(
56+ [' caffeine' , ' metformin' , ' TP53' ],
57+ id_types = [' name' , ' chebi' , ' hmdb' , ' uniprot' , ' genesymbol' ],
58+ )
59+
60+ # Compounds reported in strawberry (FooDB), as a wide joined table
61+ op.related(
62+ subject = ' Strawberry' ,
63+ sources = [' foodb' ],
64+ id_types = [' name' , ' chebi' , ' hmdb' ],
65+ )
66+
67+ # Drug targets for caffeine (positional arg matches either side)
68+ op.related(
69+ ' caffeine' ,
70+ sources = [' bindingdb' ],
71+ id_types = [' name' , ' uniprot' , ' genesymbol' ],
72+ )
73+
74+ # Pathway members from WikiPathways and Reactome at once
75+ op.related(
76+ object = [' WP253' , ' R-HSA-70171' ],
77+ sources = [' wikipathways' , ' reactome' ],
78+ relation_categories = [' annotation' ],
79+ id_types = [' name' , ' uniprot' , ' chebi' ],
80+ group_by = ' object_name' ,
81+ )
82+ ```
4583
46- # Directed interactions only
47- df = op.interactions(direction = ' directed' )
84+ The lower-level primitives are still available for paged scans, raw
85+ parquet, or graph export:
86+
87+ ``` python
88+ # All relations as a polars DataFrame
89+ df = op.relations()
90+
91+ # Resolve free-text identifiers to entity primary keys
92+ op.resolve([' caffeine' , ' TP53' ])
4893
4994# Human entities
5095df = op.entities(taxonomy_ids = [' 9606' ])
5196
52- # Interactions as an annnet graph
53- g = op.interactions (as_graph = True )
97+ # Relations as an annnet graph
98+ g = op.relations (as_graph = True )
5499
55100# Ontology term lookup
56101result = op.ontology_terms([' GO:0006915' , ' MI:0326' ])
@@ -59,6 +104,17 @@ result = op.ontology_terms(['GO:0006915', 'MI:0326'])
59104df = op.entities(backend = ' pandas' )
60105```
61106
107+ Cache control:
108+
109+ ``` python
110+ # Force a one-shot refresh for everything touched in the block
111+ with op.fresh():
112+ df = op.related(' caffeine' , sources = [' bindingdb' ])
113+
114+ # Wipe the entire on-disk cache (e.g. after a server redeploy)
115+ op.cache_clear()
116+ ```
117+
62118For more examples, see the [ quickstart guide] ( https://saezlab.github.io/omnipath-client/quickstart/ ) .
63119
64120## OmniPath Utils
0 commit comments