Usage
This notebook provides the steps to build a network starting from a list of genes, and using the default functionalities of NeKo.
[1]:
%%time
from neko.core.network import Network
from neko._visual.visualize_network import NetworkVisualizer
import omnipath as op
CPU times: user 6.12 s, sys: 1.61 s, total: 7.73 s
Wall time: 5.23 s
1. Define the list of genes of interest
[2]:
genes = ["SRC", "NOTCH1", "FAK", "CDH1", "CDH2", "VIM", "MAP4K4", "LATS1", "LATS2", "PTK2B"]
2. Create a network using as input the gene set.
Note
NB! If no resource is specified, the default used resource by the package is omnipath.all_interactions()
. To add new resources, please see the Add resources tutorial.
2A. Import genes as network nodes
[3]:
new_net1 = Network(genes, resources = 'omnipath')
[4]:
#Print node dataframe
new_net1.nodes
[4]:
Genesymbol | Uniprot | Type | |
---|---|---|---|
0 | SRC | P12931 | NaN |
1 | NOTCH1 | P46531 | NaN |
2 | PTK2 | Q05397 | NaN |
3 | CDH1 | P12830 | NaN |
4 | CDH2 | P19022 | NaN |
5 | VIM | P08670 | NaN |
6 | MAP4K4 | O95819 | NaN |
7 | LATS1 | O95835 | NaN |
8 | LATS2 | Q9NRM7 | NaN |
9 | PTK2B | Q14289 | NaN |
2B. Explore if the nodes are connected without introducing new intermidiate nodes
[5]:
%%time
new_net1.connect_nodes(only_signed=True, consensus_only=True)
CPU times: user 169 ms, sys: 170 µs, total: 169 ms
Wall time: 168 ms
2C. Visualize the network with the following command.
The network picture is also exported in the working repository, in pdf format.
[6]:
visualizer = NetworkVisualizer(new_net1, color_by='effect', noi=True)
visualizer.render()
2D. Connect disconnected nodes by importing intermediate nodes.
The parameter maxlen sets the maximum length of the paths to be searched of.
The parameter algorithm sets the base algorithm to use when looking for paths in the resources. It can be ‘bfs’ (Breadth-First Search) or ‘dfs’ (Depth-First Search). The first one is faster but does not always retrieve the shortest path, while the second one retrieves all the possible shortest paths at higher computational cost.
The parameter only_signed forces the algorithm to look for just signed interactions.
The parameter consensus retrieves those interactions with a sign consensus between the references (when possible).
The parameter connect_with_bias, changes the base algorithm, making it look for possible connection between all the disconnected node in the network when a new bridge-gene is introduced in the network, biasing the final network topology.
[7]:
%%time
new_net1.complete_connection(maxlen=3, algorithm="bfs", only_signed=True, connect_with_bias=False, consensus=True)
CPU times: user 9.08 s, sys: 6.68 ms, total: 9.08 s
Wall time: 9.08 s
3. Visualize final network
[8]:
#Visualize a specific nodes and
visualizer1 = NetworkVisualizer(new_net1,color_by='effect', noi=True)
visualizer1.render()
[9]:
#Visualize a specific nodes and
visualizer1 = NetworkVisualizer(new_net1, predefined_node = "SRC",color_by='effect')
visualizer1.render()
[10]:
#We can access to the edges of the network
new_net1.edges
[10]:
source | target | Type | Effect | References | |
---|---|---|---|---|---|
0 | P12931 | Q05397 | None | stimulation | Adhesome:10085298;Adhesome:10592173;Adhesome:1... |
1 | P12830 | P12931 | None | stimulation | ACSN:16039586;ACSN:16099633;ACSN:17143292;ACSN... |
2 | P12931 | P19022 | None | inhibition | ACSN:15782139;ACSN:16371504;ACSN:16492141;ACSN... |
3 | P12931 | Q14289 | None | stimulation | Adhesome:10329689;Adhesome:10521452;Adhesome:1... |
4 | Q14289 | Q05397 | None | stimulation | Adhesome:16760434;HPRD:16760434;KEA:12960434;K... |
... | ... | ... | ... | ... | ... |
170 | P17612 | P50552 | None | stimulation | Adhesome:10851246;Adhesome:10922374;Adhesome:8... |
171 | Q13153 | O95863 | None | stimulation | InnateDB:15833848;KEA:15833848;PhosphoSite:158... |
172 | Q13153 | Q99759 | None | stimulation | NaN |
173 | P00519 | Q13188 | None | stimulation | PhosphoSite:22590567;ProtMapper:22590567;ProtM... |
174 | Q13315 | P00519 | None | stimulation | ACSN:11804596;ACSN:11877377;ACSN:12607003;ACSN... |
175 rows × 5 columns