liana.rs.build_prior_network

liana.rs.build_prior_network#

liana.rs.build_prior_network(ppis, input_nodes, output_nodes, lr_sep=None, verbose=False)#

Build Prior Network from PPIs and input/output nodes.

Parameters:
ppis DataFrame | Sequence[tuple[str, float, str]]

The PPIs to use for the prior network. If a list, each element must be a (source, mor, target) tuple where mor is +1 or -1. If a pandas DataFrame is provided, it must have the columns source, mor, and target.

input_nodes Mapping[str, float]

A dictionary of input nodes. The keys are the node names, the values are the node scores.

output_nodes Mapping[str, float]

A dictionary of output nodes. The keys are the node names, the values are the node scores.

lr_sep str | None (default: None)

The separator to use to split the input nodes into ligand and receptor. If None, the input nodes will be used as is.

verbose bool (default: False)

Whether to print progress information. Default: True

Return type:

Graph

Returns:

corneto.Graph

Examples

ppis is a signed protein-protein interaction network – normally from OmniPath – given either as (source, sign, target) tuples or as a DataFrame with source/mor/target columns. A tiny one is written out here so the example stays offline. lr_sep strips the ligand from an interaction name, so that 'HLA-DRA^CD4' matches the receptor 'CD4':

>>> import liana as li
>>> ppis = [("CD4", 1, "LCK"), ("LCK", 1, "JUN"), ("LCK", -1, "FOS")]
>>> prior = li.rs.build_prior_network(
...     ppis, input_nodes={"HLA-DRA^CD4": 1.0}, output_nodes={"JUN": 1.0, "FOS": -1.0}, lr_sep="^"
... )

The network is pruned to what lies on a path from an input to an output. Hand the result to liana.mt.find_causalnet().