Usage

This notebook provides the steps to build a network starting from a list of genes, and using the default functionalities of Omniflow.

[2]:
%%time
from neko.core.network import Network
from neko._visual.visualize_network import NetworkVisualizer
from neko._inputs.resources import Resources
from neko._annotations.gene_ontology import Ontology
import omnipath as op
CPU times: user 1.85 s, sys: 357 ms, total: 2.21 s
Wall time: 2.15 s

1. Define the list of genes of interest

[3]:
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

[4]:
new_net1 = Network(genes)
[5]:
#Print node dataframe
new_net1.nodes
[5]:
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

[6]:
%%time
new_net1.connect_nodes(only_signed=True, consensus_only=True)
CPU times: user 889 ms, sys: 0 ns, total: 889 ms
Wall time: 888 ms

2C. Visualize the network with the following command.

The network picture is also exported in the working repository, in pdf format.

[7]:
visualizer = NetworkVisualizer(new_net1, color_by='effect')
visualizer.render()
../_images/notebooks_1_network_building_11_0.svg

2D. Connect disconnected nodes by importing intermediate nodes.

The parameter maxlen is used to verify that in the network all the nodes have a distance < than maxlen.

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.

The parameter connect_node_when_first_introduced, 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.

[8]:
%%time
new_net1.complete_connection(maxlen=6, k_mean="tight", only_signed=True, connect_node_when_first_introduced=True, consensus=False)
Found a path!
Found a path!
Found a path!
Found a path!
Found a path!
Found a path!
Found a path!
Found a path!
Found a path!
Found a path!
Found a path!
CPU times: user 3min 27s, sys: 98.8 ms, total: 3min 27s
Wall time: 3min 27s

3. Visualize final network

[11]:
#Visualize a specific nodes and
visualizer1 = NetworkVisualizer(new_net1,color_by='effect')
visualizer1.render(output_file='network2')
../_images/notebooks_1_network_building_15_0.svg
[10]:
#Visualize a specific nodes and
visualizer1 = NetworkVisualizer(new_net1, predefined_node = "SRC",color_by='effect')
visualizer1.render(output_file='network2')
../_images/notebooks_1_network_building_16_0.svg
[10]:
#We can access to the edges of the network
new_net1.edges
[10]:
source target Type Effect References
6821 P12931 Q05397 None stimulation Adhesome:10085298;Adhesome:10592173;Adhesome:1...
32968 P12931 P19022 None inhibition ACSN:15782139;ACSN:16371504;ACSN:16492141;ACSN...
5154 P12931 Q14289 None stimulation Adhesome:10329689;Adhesome:10521452;Adhesome:1...
44795 Q14289 Q05397 None stimulation Adhesome:16760434;HPRD:16760434;KEA:12960434;K...
11582 P12931 P35222 None stimulation ACSN:10593980;ACSN:12123611;ACSN:15782139;ACSN...
... ... ... ... ... ...
67482 P00533 Q05397 None stimulation ACSN:10545505;ACSN:16919435;ACSN:17496910;ACSN...
7631 Q14289 P00533 None stimulation CA1:11274221;HPRD:10777553;InnateDB:14963038;S...
73973 P00533 P35222 None stimulation ACSN:12040186;ACSN:14585353;ACSN:17496910;ACSN...
2907 Q15139 P00533 None stimulation CancerCellMap:10523301;CancerCellMap:2984676;C...
78053 P00533 P56945 None inhibition KEA:17570479;ProtMapper:15951569;SPIKE_LC:1714...

71 rows × 5 columns