In the context of network integration, we propose the
INet
algorithm. INet
assumes a similar network
structure, representing latent variables in different network layers of
the same system. Therefore, by combining individual edge weights and
topological network structures, INet
first constructs a
Consensus Network
that represents the shared information
underneath the different layers to provide a global view of the entities
that play a fundamental role in the phenomenon of interest. Then, it
derives a Case Specific Network
for each layer containing
peculiar information of the single data type not present in all the
others.
# Install from CRAN
# install.packages("INetTool")
# Install from GitHub
# install.packages("devtools")
#devtools::install_github("ValeriaPolicastro/INet-Tool")
Load the package and a list with the example datasets. In this case, columns of both datasets represent patients, while rows represent gene expression, methylation and mirna expression respectively.
library(INetTool)
data("exampleL_data")
If you do not have already the weighted networks, as in our example, you can construct them throughout this function:
net <- constructionGraph(exampleL_data)
If you have already the networks skip this step.
The function constructs similarity networks based on pearson correlation and the percentile parameter, in our example it constructs 3 patient similarity networks.
For this example we named:
adjL the list of weighted adjacency matrices needed for the next functions
adjL <- net$Adj
graphL the list of graphs needed for the next functions
graphL <- net$Graphs
To detect how similar are the networks you can use the Jaccard distance matrix function:
JWmatrix(graphL)
## vetI vetI vetI
## vetI 0.0000000 0.9046842 0.9203484
## vetI 0.9046842 0.0000000 0.9434781
## vetI 0.9203484 0.9434781 0.0000000
or the Mean Weighted Jaccard Distance for Multilayer Networks a global distance function:
JWmean(graphL)
## [1] 0.9228369
To calculate different measures on the different graphs you can easly use the following function:
measures <- measuresNet(graphL, nodes.measures=F)
(default nodes.measures=T gives measures also about the nodes)
The measures of the first graph:
measures[[1]]
## $graphsMeasures
## values
## vertices 2.150000e+02
## edges 1.049000e+03
## transitivity 5.180470e-01
## diameter 4.318253e+00
## modularityLouvain 6.744669e-01
## edgeDensity 4.559878e-02
## assortativity 2.122518e-01
## centrDegree 7.589654e-02
## centrBetween 1.076573e-01
To plot all the layers in one plot use:
plotL(graphL,vertex.cex=.1,vertex.labels.cex=.1, vertex.color = 18)
different parameter can be specified for the plot.
To construct the Consensus Network use a list of weighted adjacency matrices:
Note: consensusNet
needs the same row and
column names for all the matrices, if you do not have it use the
adj_rename
function before the consensus
Con <- consensusNet (adjL, theta=0.05)
## Multilayer network distance: 0.3488464
## Multilayer network distance: 0.08620715
From our simulation study, we detected that the best theta for 500 nodes network is 0.04 and the best one for 100 nodes network is 0.06,thus for this example with 200 nodes we setted the parameter to 0.05.
The output are:
Con$graphConsensus
## IGRAPH 7a596f2 UNW- 215 39 --
## + attr: name (v/c), weight (e/n)
## + edges from 7a596f2 (vertex names):
## [1] P7 --P89 P7 --P96 P10 --P21 P12 --P48 P13 --P53 P27 --P115
## [7] P27 --P169 P34 --P45 P34 --P48 P34 --P49 P34 --P155 P36 --P96
## [13] P44 --P89 P45 --P48 P45 --P52 P45 --P55 P45 --P155 P48 --P49
## [19] P48 --P55 P48 --P71 P49 --P71 P52 --P55 P80 --P193 P88 --P173
## [25] P89 --P96 P92 --P151 P95 --P168 P102--P112 P103--P166 P112--P135
## [31] P112--P181 P117--P181 P118--P134 P135--P176 P135--P189 P138--P169
## [37] P173--P185 P176--P181 P181--P189
Con$Comparison
## [,1]
## Comparison 0.92283689
## CompPost 0.34884641
## CompPost 0.08620715
Con$similarGraphs
## [[1]]
## IGRAPH 0f9698e UNW- 215 2691 --
## + attr: NA (v/c), name (v/c), weight (e/n)
## + edges from 0f9698e (vertex names):
## [1] P1--P2 P1--P3 P1--P4 P1--P5 P1--P11 P1--P12 P1--P13 P1--P16
## [9] P1--P17 P1--P18 P1--P19 P1--P20 P1--P21 P1--P53 P1--P78 P1--P88
## [17] P1--P171 P1--P173 P2--P3 P2--P4 P2--P6 P2--P10 P2--P11 P2--P12
## [25] P2--P13 P2--P15 P2--P17 P2--P18 P2--P19 P2--P20 P2--P21 P2--P45
## [33] P3--P4 P3--P5 P3--P8 P3--P9 P3--P12 P3--P14 P3--P16 P3--P17
## [41] P3--P18 P3--P19 P3--P20 P4--P8 P4--P10 P4--P11 P4--P15 P4--P17
## [49] P4--P18 P4--P19 P4--P21 P5--P9 P5--P12 P5--P14 P5--P16 P5--P17
## [57] P5--P18 P5--P19 P5--P20 P6--P8 P6--P9 P6--P14 P6--P17 P7--P23
## + ... omitted several edges
##
## [[2]]
## IGRAPH ef5879a UNW- 215 2691 --
## + attr: NA (v/c), name (v/c), weight (e/n)
## + edges from ef5879a (vertex names):
## [1] P1--P10 P1--P13 P1--P19 P1--P21 P1--P29 P1--P34 P1--P35 P1--P52
## [9] P2--P38 P3--P28 P3--P39 P3--P41 P3--P47 P3--P51 P3--P58 P3--P61
## [17] P4--P8 P4--P14 P4--P15 P4--P28 P4--P38 P4--P39 P4--P41 P4--P47
## [25] P4--P51 P4--P58 P4--P63 P5--P7 P5--P9 P5--P11 P5--P16 P5--P20
## [33] P5--P27 P5--P36 P5--P43 P5--P44 P5--P82 P5--P89 P5--P95 P5--P96
## [41] P5--P115 P5--P138 P5--P158 P5--P168 P5--P169 P6--P16 P6--P23 P6--P163
## [49] P7--P11 P7--P27 P7--P36 P7--P43 P7--P44 P7--P82 P7--P89 P7--P96
## [57] P7--P158 P8--P10 P8--P14 P8--P19 P8--P21 P8--P25 P8--P28 P8--P29
## + ... omitted several edges
##
## [[3]]
## IGRAPH f80f822 UNW- 215 2691 --
## + attr: NA (v/c), name (v/c), weight (e/n)
## + edges from f80f822 (vertex names):
## [1] P1--P2 P1--P37 P1--P43 P1--P73 P1--P184 P1--P214 P2--P5 P2--P7
## [9] P2--P25 P2--P43 P2--P47 P2--P59 P2--P89 P2--P112 P2--P135 P2--P142
## [17] P2--P181 P2--P189 P2--P195 P3--P20 P3--P171 P4--P124 P5--P7 P5--P11
## [25] P5--P23 P5--P27 P5--P38 P5--P44 P5--P66 P5--P89 P5--P96 P5--P102
## [33] P5--P121 P5--P132 P5--P142 P5--P148 P5--P157 P5--P158 P5--P169 P5--P181
## [41] P5--P189 P5--P211 P6--P9 P6--P47 P6--P73 P6--P112 P6--P135 P6--P140
## [49] P6--P142 P6--P184 P6--P189 P6--P199 P6--P214 P6--P215 P7--P59 P7--P89
## [57] P7--P96 P7--P102 P7--P121 P7--P132 P7--P138 P7--P142 P7--P158 P7--P163
## + ... omitted several edges
The similar graphs are useful if it is needed to change the final
thresholding, instead of computing again the algorithm you can use
directly thresholdNet
function.
Plotting the Consensus Network you can find the common informations present in all the layers:
plotC(Con$graphConsensus,vertex.size=6, vertex.label.cex =0.5,vertex.color = 18)
To construct Case Specific Networks one for each layer to give information of the peculiar layer not present in the Consensus:
specificNet(graphL, Con$graphConsensus)
## $GraphsDifference
## $GraphsDifference[[1]]
## IGRAPH b01937e UNW- 215 1010 --
## + attr: name (v/c), weight (e/n)
## + edges from b01937e (vertex names):
## [1] P1--P173 P1--P171 P1--P88 P1--P78 P1--P53 P1--P21 P1--P20 P1--P19
## [9] P1--P18 P1--P17 P1--P16 P1--P13 P1--P12 P1--P11 P1--P5 P1--P4
## [17] P1--P3 P1--P2 P2--P45 P2--P21 P2--P20 P2--P19 P2--P18 P2--P17
## [25] P2--P15 P2--P13 P2--P12 P2--P11 P2--P10 P2--P6 P2--P4 P2--P3
## [33] P3--P20 P3--P19 P3--P18 P3--P17 P3--P16 P3--P14 P3--P12 P3--P9
## [41] P3--P8 P3--P5 P3--P4 P4--P21 P4--P19 P4--P18 P4--P17 P4--P15
## [49] P4--P11 P4--P10 P4--P8 P5--P20 P5--P19 P5--P18 P5--P17 P5--P16
## [57] P5--P14 P5--P12 P5--P9 P6--P17 P6--P14 P6--P9 P6--P8 P7--P189
## + ... omitted several edges
##
## $GraphsDifference[[2]]
## IGRAPH a33c2b7 UNW- 215 1014 --
## + attr: name (v/c), weight (e/n)
## + edges from a33c2b7 (vertex names):
## [1] P1--P52 P1--P35 P1--P34 P1--P29 P1--P21 P1--P19 P1--P13 P1--P10
## [9] P2--P38 P3--P61 P3--P58 P3--P51 P3--P47 P3--P41 P3--P39 P3--P28
## [17] P4--P63 P4--P58 P4--P51 P4--P47 P4--P41 P4--P39 P4--P38 P4--P28
## [25] P4--P15 P4--P14 P4--P8 P5--P169 P5--P168 P5--P158 P5--P138 P5--P115
## [33] P5--P96 P5--P95 P5--P89 P5--P82 P5--P44 P5--P43 P5--P36 P5--P27
## [41] P5--P20 P5--P16 P5--P11 P5--P9 P5--P7 P6--P163 P6--P23 P6--P16
## [49] P7--P158 P7--P82 P7--P44 P7--P43 P7--P36 P7--P27 P7--P11 P8--P51
## [57] P8--P47 P8--P41 P8--P39 P8--P31 P8--P29 P8--P28 P8--P25 P8--P21
## + ... omitted several edges
##
## $GraphsDifference[[3]]
## IGRAPH 8471b3b UNW- 215 1014 --
## + attr: name (v/c), weight (e/n)
## + edges from 8471b3b (vertex names):
## [1] P1--P214 P1--P184 P1--P73 P1--P43 P1--P37 P1--P2 P2--P195 P2--P189
## [9] P2--P181 P2--P142 P2--P135 P2--P112 P2--P89 P2--P59 P2--P47 P2--P43
## [17] P2--P25 P2--P7 P2--P5 P3--P171 P3--P20 P4--P124 P5--P211 P5--P189
## [25] P5--P181 P5--P169 P5--P158 P5--P157 P5--P148 P5--P142 P5--P132 P5--P121
## [33] P5--P102 P5--P96 P5--P89 P5--P66 P5--P44 P5--P38 P5--P27 P5--P23
## [41] P5--P11 P5--P7 P6--P215 P6--P214 P6--P199 P6--P189 P6--P184 P6--P142
## [49] P6--P140 P6--P135 P6--P112 P6--P73 P6--P47 P6--P9 P7--P211 P7--P195
## [57] P7--P189 P7--P181 P7--P163 P7--P158 P7--P142 P7--P138 P7--P132 P7--P121
## + ... omitted several edges
##
##
## $percentageOfSpecificity
## [1] 0.9628217 0.9666349 0.9666349
To plot a starting layer and the Consensus in one graph with different edge colours: red edges represent edges of the Consensus already present in the starting one, while light blue edges represent new edges constructed by the Consensus.
plotINet(adjL[[1]], Con$graphConsensus, vertex.labels.cex=.01, vertex.size=2)