|
| 1 | +# COSMOS Prior-Knowledge Network |
| 2 | + |
| 3 | +This vignette shows how to use omnipath-client to access the COSMOS |
| 4 | +prior-knowledge network (PKN) -- a multi-layer network designed for |
| 5 | +multi-omics causal reasoning with |
| 6 | +[cosmosR](https://github.com/saezlab/cosmosR). |
| 7 | + |
| 8 | +The COSMOS PKN integrates metabolite-protein interactions, protein-protein |
| 9 | +signaling, and gene regulation from curated databases into a single |
| 10 | +directed signed network. It is served by the |
| 11 | +[metabo.omnipathdb.org](https://metabo.omnipathdb.org) web service and |
| 12 | +built by the [omnipath-metabo](https://github.com/saezlab/omnipath-metabo) |
| 13 | +package. |
| 14 | + |
| 15 | +## Setup |
| 16 | + |
| 17 | +```python |
| 18 | +pip install omnipath-client |
| 19 | +``` |
| 20 | + |
| 21 | +```python |
| 22 | +import omnipath_client as oc |
| 23 | +``` |
| 24 | + |
| 25 | +## Network categories |
| 26 | + |
| 27 | +The PKN is organized into six categories covering different layers of |
| 28 | +molecular interaction: |
| 29 | + |
| 30 | +| Category | Description | |
| 31 | +|----------|-------------| |
| 32 | +| `transporters` | Metabolite transport across membranes (TCDB, SLC, GEMs, MRCLinksDB) | |
| 33 | +| `receptors` | Metabolite-receptor binding at the cell surface (STITCH, MRCLinksDB) | |
| 34 | +| `allosteric` | Allosteric regulation of enzymes by metabolites (BRENDA, STITCH) | |
| 35 | +| `enzyme_metabolite` | Enzyme-metabolite stoichiometric reactions from GEMs | |
| 36 | +| `ppi` | Protein-protein signaling from OmniPath | |
| 37 | +| `grn` | Gene regulatory network from CollecTRI / DoRothEA | |
| 38 | + |
| 39 | +## Fetch the full PKN |
| 40 | + |
| 41 | +```python |
| 42 | +# Full human PKN (all 6 categories) |
| 43 | +df = oc.cosmos.get_pkn('human') |
| 44 | +``` |
| 45 | + |
| 46 | +The result is a DataFrame with columns `source`, `target`, and `sign` |
| 47 | +(mode of regulation: 1 = stimulation, -1 = inhibition). |
| 48 | + |
| 49 | +## Filter by category |
| 50 | + |
| 51 | +```python |
| 52 | +# Only transporters and receptors |
| 53 | +df = oc.cosmos.get_pkn('human', categories=['transporters', 'receptors']) |
| 54 | + |
| 55 | +# PPI layer only |
| 56 | +df = oc.cosmos.get_pkn('human', categories='ppi') |
| 57 | +``` |
| 58 | + |
| 59 | +## Filter by resource |
| 60 | + |
| 61 | +```python |
| 62 | +# Only STITCH receptor edges |
| 63 | +df = oc.cosmos.get_pkn( |
| 64 | + 'human', |
| 65 | + categories='receptors', |
| 66 | + resources='STITCH', |
| 67 | +) |
| 68 | +``` |
| 69 | + |
| 70 | +## Multi-organism support |
| 71 | + |
| 72 | +The PKN is available for human, mouse, and rat. The `organism` parameter |
| 73 | +accepts NCBI taxonomy IDs, common names, Latin names, or short codes. |
| 74 | + |
| 75 | +```python |
| 76 | +# Mouse PKN |
| 77 | +df_mouse = oc.cosmos.get_pkn('mouse') |
| 78 | + |
| 79 | +# Rat PKN |
| 80 | +df_rat = oc.cosmos.get_pkn('rat') |
| 81 | + |
| 82 | +# Using NCBI taxonomy ID |
| 83 | +df = oc.cosmos.get_pkn(10090) |
| 84 | +``` |
| 85 | + |
| 86 | +## AnnNet graph conversion |
| 87 | + |
| 88 | +Convert the PKN to an [AnnNet](https://github.com/saezlab/annnet) |
| 89 | +graph object for network analysis: |
| 90 | + |
| 91 | +```python |
| 92 | +# Directly as an AnnNet graph |
| 93 | +g = oc.cosmos.get_pkn('mouse', format='annnet') |
| 94 | + |
| 95 | +# Or convert an existing DataFrame |
| 96 | +df = oc.cosmos.get_pkn('human') |
| 97 | +g = oc.cosmos.to_annnet(df) |
| 98 | +``` |
| 99 | + |
| 100 | +## Convenience functions |
| 101 | + |
| 102 | +Explore what is available on the server: |
| 103 | + |
| 104 | +```python |
| 105 | +# Available categories |
| 106 | +oc.cosmos.categories() |
| 107 | +# ['transporters', 'receptors', 'allosteric', 'enzyme_metabolite', 'ppi', 'grn'] |
| 108 | + |
| 109 | +# Supported organisms |
| 110 | +oc.cosmos.organisms() |
| 111 | +# [9606, 10090, 10116] |
| 112 | + |
| 113 | +# Resources per category |
| 114 | +oc.cosmos.resources() |
| 115 | +# {'transporters': ['TCDB', 'SLC', 'GEM:Human-GEM', ...], ...} |
| 116 | +``` |
| 117 | + |
| 118 | +## Web service |
| 119 | + |
| 120 | +The COSMOS PKN is served at |
| 121 | +[metabo.omnipathdb.org](https://metabo.omnipathdb.org). You can also |
| 122 | +query the REST API directly: |
| 123 | + |
| 124 | +``` |
| 125 | +GET https://metabo.omnipathdb.org/cosmos/pkn?organism=9606&categories=all |
| 126 | +GET https://metabo.omnipathdb.org/cosmos/pkn?organism=10090&categories=transporters,ppi |
| 127 | +GET https://metabo.omnipathdb.org/cosmos/categories |
| 128 | +GET https://metabo.omnipathdb.org/cosmos/organisms |
| 129 | +GET https://metabo.omnipathdb.org/cosmos/resources |
| 130 | +``` |
0 commit comments