Function Repository Resource:

NetworkBasedInferenceScore

Source Notebook

Calculate the network-based inference (NBI) connection score between two vertices in a bipartite graph

Contributed by: Shayan K. Azmoodeh

ResourceFunction["NetworkBasedInferenceScore"][g,d,t]

gives the network based inference (NBI) score between the drug vertex d and the target vertex t in the graph g.

Details

ResourceFunction["NetworkBasedInferenceScore"] is based on the implementation described by Ding et al. for predicting drug-target interactions in bioinformatics.
ResourceFunction["NetworkBasedInferenceScore"] calculates the score based on how many connections each vertex has and the relation of their connections to each other. It effectively predicts the strength of an edge between two vertices that are not connected by an edge.
The input drug and target vertices do not need to have an edge between them.
If a drug or target vertex given is not in the given graph, ResourceFunction["NetworkBasedInferenceScore"] returns 0.

Examples

Basic Examples (2) 

Create a simple network of pharmaceutical drugs and their viral targets:

In[1]:=
g1 = Graph[{"Sovaprevir", "Danoprevir", "HCV NS3/4A", "SARS-CoV-2 MPro"}, {
UndirectedEdge["Sovaprevir", "HCV NS3/4A"], 
UndirectedEdge["Danoprevir", "HCV NS3/4A"], 
UndirectedEdge["Glecaprevir", "HCV NS3/4A"], 
UndirectedEdge["Glecaprevir", "SARS-CoV-2 MPro"]}, GraphLayout -> "BipartiteEmbedding", VertexLabels -> All]
Out[1]=

Calculate the NBI score between a drug and target vertex:

In[2]:=
ResourceFunction[
 "NetworkBasedInferenceScore"][g1, "Glecaprevir", "SARS-CoV-2 MPro"]
Out[2]=

A bipartite graph:

In[3]:=
g2 = Graph[{1 \[UndirectedEdge] a, 1 \[UndirectedEdge] c, 1 \[UndirectedEdge] d, 2 \[UndirectedEdge] a, 2 \[UndirectedEdge] b, 2 \[UndirectedEdge] d, 3 \[UndirectedEdge] c, 3 \[UndirectedEdge] d, 3 \[UndirectedEdge] e}, GraphLayout -> "BipartiteEmbedding", VertexLabels -> All]
Out[3]=

The NBI score can be calculated for pairs of vertices that have an edge between them as well:

In[4]:=
ResourceFunction["NetworkBasedInferenceScore"][g2, 2, b]
Out[4]=

Scope (1) 

Network edges can be labeled with the NBI scores:

In[5]:=
g1 = Graph[{"Sovaprevir", "Danoprevir", "HCV NS3/4A", "SARS-CoV-2 MPro"}, {
UndirectedEdge["Sovaprevir", "HCV NS3/4A"], UndirectedEdge["Danoprevir", "HCV NS3/4A"], 
UndirectedEdge["Glecaprevir", "HCV NS3/4A"], 
UndirectedEdge["Glecaprevir", "SARS-CoV-2 MPro"]}, GraphLayout -> "BipartiteEmbedding", VertexLabels -> All];
noEdge = {"Sovaprevir" \[UndirectedEdge] "SARS-CoV-2 MPro", "Danoprevir" \[UndirectedEdge] "SARS-CoV-2 MPro"};
In[6]:=
g3 = Graph[{"Sovaprevir", "Danoprevir", "HCV NS3/4A", "SARS-CoV-2 MPro"}, {
UndirectedEdge["Sovaprevir", "HCV NS3/4A"], 
UndirectedEdge["Danoprevir", "HCV NS3/4A"], 
UndirectedEdge["Glecaprevir", "HCV NS3/4A"], 
UndirectedEdge["Glecaprevir", "SARS-CoV-2 MPro"], 
UndirectedEdge["Sovaprevir", "SARS-CoV-2 MPro"], 
UndirectedEdge["Danoprevir", "SARS-CoV-2 MPro"]}, GraphLayout -> "BipartiteEmbedding", VertexLabels -> All, EdgeLabels -> Table[i -> Placed[N[
       ResourceFunction["NetworkBasedInferenceScore"][g1, i[[1]], i[[2]]]], 1/4], {i, Join[EdgeList[g1], noEdge]}], EdgeStyle -> Table[i -> Dashed, {i, noEdge}]]
Out[6]=

Publisher

Shayan Azmoodeh

Version History

  • 1.0.0 – 14 June 2021

Source Metadata

License Information