liana.method.build_prior_network

liana.method.build_prior_network#

liana.method.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 | list[tuple[str, str]]) – The PPIs to use for the prior network. If a pandas DataFrame is provided, it must have the columns

  • input_nodes (dict[str, float]) – A dictionary of input nodes. The keys are the node names, the values are the node scores.

  • output_nodes (dict[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

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.mt.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.method.find_causalnet().