corneto.methods package#
Subpackages#
Submodules#
corneto.methods.carnival module#
- corneto.methods.carnival.read_dataset(zip_path)#
Extracts and processes a graph and its vertex attributes from a zipped dataset.
The function reads two CSV files from a specified zipfile: ‘pkn.csv’ and ‘data.csv’. The ‘pkn.csv’ contains graph edges with three columns: ‘source’, ‘interaction’, and ‘target’. The ‘interaction’ column uses integers to denote the type of interaction (1 for activation, -1 for inhibition). The ‘data.csv’ file contains vertex attributes with three columns: ‘vertex’, ‘value’, and ‘type’, where ‘value’ can be a continuous measure such as from a t-statistic in differential expression, and ‘type’ categorizes vertices as either inputs (‘P’ for perturbation) or outputs (‘M’ for measurement).
- Parameters:
zip_path (str) – The file path to the zip file containing the dataset.
- Returns:
- A tuple containing:
Graph: A graph object initialized with edges from ‘pkn.csv’. Each edge is defined by a source, a target, and an interaction type.
dict: A dictionary mapping each protein (vertex) to a tuple of (‘type’, ‘value’), where ‘type’ is either ‘P’ or ‘M’ and ‘value’ represents the continuous state of the protein.
- Return type:
- Raises:
FileNotFoundError – If the zip file cannot be found at the provided path.
KeyError – If expected columns are missing in the CSV files, indicating incorrect or incomplete data.
Example
>>> graph, vertex_attrs = read_dataset('path/to/dataset.zip') >>> print(graph.shape) # Shape of the imported graph ([vertices, edges]) >>> print(vertex_attrs) # Displays protein attributes
- corneto.methods.carnival.runVanillaCarnival(perturbations, measurements, priorKnowledgeNetwork, betaWeight=0.2, solver=None, backend_options={}, solve=True, verbose=True, **kwargs)#
- corneto.methods.carnival.runInverseCarnival(measurements, priorKnowledgeNetwork, betaWeight=0.2, solver=None, solve=True, **kwargs)#
- corneto.methods.carnival.heuristic_carnival(priorKnowledgeNetwork, perturbations, measurements, restricted_search=False, prune=True, verbose=True, max_time=None, max_edges=None)#
- corneto.methods.carnival.get_result(P, G, condition='c0', exclude_dummies=True)#
- corneto.methods.carnival.get_selected_edges(P, G, condition='c0', exclude_dummies=True)#
- corneto.methods.carnival.reachability_graph(G, input_nodes, output_nodes, subset_edges=None, verbose=True, early_stop=False, expand_outputs=True, max_printed_outputs=10)#
- corneto.methods.carnival.bfs_search(G, initial_dict, final_dict, max_time=None, queue_max_size=None, subset_edges=None, max_edges=None, verbose=True)#
corneto.methods.shortest_path module#
- corneto.methods.shortest_path.shortest_path(G, s, t, edge_weights=None, integral_path=True, create_flow_graph=True, backend=<corneto.backend._cvxpy_backend.CvxpyBackend object>)#
- corneto.methods.shortest_path.solve_shortest_path(G, s, t, edge_weights=None, solver=None, backend=<corneto.backend._cvxpy_backend.CvxpyBackend object>, integer_tolerance=1e-06, solver_kwargs=None)#
corneto.methods.signaling module#
- corneto.methods.signaling.create_flow_graph(g, conditions, pert_id='P', meas_id='M', longitudinal_samples=False)#
- corneto.methods.signaling.signflow_constraints(g, backend=<corneto.backend._cvxpy_backend.CvxpyBackend object>, signal_implies_flow=True, flow_implies_signal=False, dag=True, use_flow_indicators=True, eps=0.001)#
- corneto.methods.signaling.default_sign_loss(conditions, problem, l0_edges=0.0, l0_vertices=0.0, l1_flow=0.0, ub_loss=None, lb_loss=None)#
- corneto.methods.signaling.signflow(g, conditions, signal_implies_flow=True, flow_implies_signal=False, dag=True, l0_penalty_edges=0.0, l1_penalty_flow=0.0, l0_penalty_vertices=0.0, ub_loss=None, lb_loss=None, use_flow_indicators=True, eps=0.001, backend=<corneto.backend._cvxpy_backend.CvxpyBackend object>)#
corneto.methods.steiner module#
- corneto.methods.steiner.exact_steiner_tree(G, terminals, edge_weights=None, root=None, tolerance=0.001, strict_acyclic=False, flow_name='_flow', backend=<corneto.backend._cvxpy_backend.CvxpyBackend object>)#
- Parameters:
G (BaseGraph)
backend (Backend)
- corneto.methods.steiner.create_exact_multi_steiner_tree(G, terminal_per_condition, edge_weights_per_condition=None, root_vertices=None, tolerance=0.001, strict_acyclic=False, lam=0.01, flow_name='flow', backend=<corneto.backend._cvxpy_backend.CvxpyBackend object>)#
- Parameters:
G (BaseGraph)
backend (Backend)