Network Functions (violin.network)
This page details how paths are defined and found in the model in VIOLIN. Because of the compact nature of the BioRECIPES model format, the model must be converted into a node-edge list for use with the NetworkX Python package.
One special feature of VIOLIN is its ability to compare interactions from machine reading output to paths that exist in the model. For two nodes, E1 and Ex, an LEE may exist with E1 regulating Ex. If in the model there is a path of multiple interactions where E1 regulates E2 which regulates E3 etc. to Ex, VIOLIN can identify this, and compare the LEE to this whole path. And indirect LEE may be a weak corroboration to the model interaction, or a direct LEE may be a specification, identifying a more direct relationship between 2 nodes than is given in the model. This functionality reduces the number of false extensions.
Functions
- violin.network.node_edge_list(model_df: pandas.core.frame.DataFrame) networkx.classes.digraph.DiGraph[source]
This function converts a model from the BioRECIPE format into a node-edge list for use with NetworkX. The converted network is a directed graph.
- Parameters
model_df (pd.DataFrame) – A model dataframe, must be in BioRECIPE format.
- Returns
node_edge_list – A directed graph representation of the model.
- Return type
nx.DiGraph
- violin.network.path_finding(regulator: str, regulated: str, sign: str, model_df: pandas.core.frame.DataFrame, graph: networkx.classes.digraph.DiGraph, kind_values: dict, reading_cxn_type: str, reading_atts: dict, attributes: list, scheme='1') Union[str, int][source]
This function searches for a path in the model, where the source and target are the identifier of the matched elements, and calculates the kind score based on the results. The Dijkstra’s algorithm is used to find the shortest path. The path is identified as a negatively regulation between source and target, if the sum of edge weights is an odd number, and vice versa.
- Parameters
regulator (str) – An identifier of the source node.
regulated (str) – An identifier of the target node.
sign (str) – A sign of interaction from the Interaction Set (IS). available options: [‘positive’, ‘negative’].
model_df (pd.DataFrame) – Model dataframe
graph (nx.DiGraph) – Model edgelist to create network for finding paths between elements.
kind_values (dict) – Dictionary containing the numerical values for the Kind Score classifications.
reading_cxn_type (str) – Connection Type of interaction from reading - ‘i’ for indirect, ‘d’ for direct.
reading_atts (dict) – attributes from interaction, where keys are attributes names and values are attributes values.
attributes (list) – attributes list for reading file.
scheme (str) – The scheme of classification, i.e. ‘1’, ‘2’, or ‘3’.
- Returns
kind – Kind Score value for the interaction.
- Return type
int
Dependencies
Python: pandas and numpy libraries, NetworkX package
VIOLIN: numeric module
Usage
Use of the path_finding function in the scoring.kind_score() module:
#If model does not contain interaction - check for path
else:
kinds.append(path_finding(model_df.loc[s_idx,'Variable'],model_df.loc[t_idx,'Variable'],
reg_sign,model_df,graph,kind_values,lee_cxn_type,reading_atts,attributes))