Inputs and interaction universes¶
Universe normalizes an interaction source into the DataFrame schema consumed
by Network. Built-in adapters cover OmniPath, SIGNOR, HuRI, and
PhosphoSitePlus; a custom DataFrame can be supplied directly.
from neko.inputs import Universe, signor
omnipath_resources = Universe("omnipath")
signor_resources = signor()
custom_resources = Universe(my_interaction_dataframe)
A bare Universe() is intentionally empty. Use an explicit resource name when
data should be loaded.
Custom interaction tables¶
A custom DataFrame needs source and target columns. Give interaction signs
either as boolean is_stimulation / is_inhibition columns or as one lowercase
effect column. Recognised effect values (case-insensitive) are:
| Meaning | Values |
|---|---|
| Stimulation | stimulation, activation, activate(s), stimulate(s), positive, +, True, 1 |
| Inhibition | inhibition, inhibit(s), repression, repress(es), negative, -, False, -1 |
| Both | bimodal, both |
| Undefined | undefined, unknown, or an empty value |
| Complex formation | form complex, complex |
Any other value raises ValueError and names the offending values; NeKo does
not guess a sign. Boolean flag columns (is_directed, is_stimulation,
is_inhibition, form_complex) accept True/False, yes/no, t/f,
y/n and 1/0/-1 in any case, and raise ValueError for other text.
import pandas as pd
from neko.core.network import Network
table = pd.DataFrame({
"source": ["EGFR", "PTEN"],
"target": ["PIK3CA", "AKT1"],
"effect": ["stimulation", "inhibition"],
})
net = Network(["EGFR", "AKT1"], resources=Universe(table).interactions)
Universe¶
Universe ¶
Load and preprocess a generic network from databases or files.
Source code in neko/inputs/_universe.py
Attributes¶
network
property
writable
¶
The network as it's been read from the original source.
method
property
¶
The method that loads the data.
param are to be passed to this method.
Methods:¶
merge
staticmethod
¶
This function concatenates the provided df with the existing one in the resources object, aligning columns and filling in missing data with NaN.
Parameters: df1 (pd.DataFrame): The DataFrame to be added. df2 (pd.DataFrame): The DataFrame to be added.
Raises: ValueError: If the 'df' parameter is not a pandas DataFrame.
Returns: None
Source code in neko/inputs/_universe.py
load ¶
check ¶
The network is loaded and contains the mandatory variables.
Adapter functions¶
network_universe ¶
Generic networks from databases, files and standard formats.
Args: resource: Name of the resource or a ready data frame to bypass the built-in loading method. kwargs: Passed to the source specific method. See the specific methods in this module for details.
Note: currently OmniPath PPI is the single available option and serves as a placeholder. Later we will dispatch all inputs through this API.
Source code in neko/inputs/_universe.py
omnipath ¶
signor ¶
Source code in neko/inputs/_universe.py
phosphosite ¶
phosphosite(organism: Literal['human', 'mouse', 'rat'] = 'human', kinase_substrate: str | None = None, regulatory_sites: str | None = None, **kwargs) -> Universe