liana.mt.find_causalnet#
- liana.mt.find_causalnet(prior_graph, input_node_scores, output_node_scores, node_weights=None, node_cutoff=0.1, min_penalty=0.01, max_penalty=1.0, missing_penalty=10, edge_penalty=0.01, solver=None, seed=1337, max_runs=1, stable_runs=5, verbose=True, **kwargs)#
Find the causal network that best explains the input/output node scores.
- Parameters:
- prior_graph
Graph The prior graph to use for the search.
- input_node_scores
Mapping[str,float] A dictionary of input node scores.
- output_node_scores
Mapping[str,float] A dictionary of output node scores.
- node_weights
Mapping[str,float] |None(default:None) A dictionary of node weights. The keys are the node names, the values are the weights. If None, all nodes will have the same weight.
- node_cutoff
float(default:0.1) The cutoff to use for the node weights. Nodes with a weight below this cutoff will be assigned the max_penalty, nodes with a weight above this cutoff will be assigned the min_penalty. Only used if node_weights is not None. Default: 0.1
- min_penalty
float(default:0.01) The minimum penalty to assign to nodes with a weight above the cutoff. Only used if node_weights is not None. Default: 0.01
- max_penalty
float(default:1.0) The maximum penalty to assign to nodes with a weight below the cutoff Only used if node_weights is not None. Default: 1.0
- missing_penalty
float(default:10) The penalty to assign to nodes that are not measured. Default: 10
- edge_penalty
float(default:0.01) The penalty to assign to edges. Default: 0.01
- solver
str|None(default:None) The solver to use. If None, the default solver will be used. Default: None It will default to the solver included in SCIPY, if no other solver is available.
- seed
int(default:1337) The seed to use for the random number generator. Default: 1337
- max_runs
int(default:1) The maximum number of runs to perform. Consider increasing this value if the solver does not converge. In each run, the noise added to the edge and node penalties is perturbed slightly (iterating over the seed). By default, only 1 run is performed.
- stable_runs
int(default:5) The number of consecutive stable solutions requires to interrupt the iteration over max_runs. Only used if max_runs is not == 1. Default: 5
- verbose
bool(default:True) Whether to print progress information. Default: True
- **kwargs
object Additional arguments to pass to the solver.
- prior_graph
- Return type:
- Returns:
Examples
Takes the pruned graph from
liana.rs.build_prior_network()and selects the sub-network whose signs are consistent with the input and output scores. This needs a mixed-integer solver; without one installed,cornetofalls back to the solver bundled with SciPy:>>> import liana as li >>> ppis = [("CD4", 1, "LCK"), ("LCK", 1, "JUN"), ("LCK", -1, "FOS")] >>> prior = li.rs.build_prior_network(ppis, input_nodes={"CD4": 1.0}, output_nodes={"JUN": 1.0, "FOS": -1.0}) >>> df, problem = li.mt.find_causalnet( ... prior, input_node_scores={"CD4": 1.0}, output_node_scores={"JUN": 1.0, "FOS": -1.0}, verbose=False ... )