Co-Expression Differential Network Analysis: CoDiNA

The usage of the Co-expression Differential Network analysis has been growing by the Biological and Medical science for the analysis of complex systems or diseases. We have developed a method that is able to compare as many networks as desired, by caracterizing both links and nodes that are common, different or specific to each network. More information can be found at [arXiv:1802.00828].

You can download the package from CRAN using:


Input data

The input data for CoDiNA is a list of data.frame, containing: Node.1, Node.2 and value. It is important to mention here that the methodology should be employed only for undirected graphs. The value is the strength of the link between Node.1 and Node.2 and must any real number between -1 to 1. This value can be re-normalized by the package using the argument stretch = TRUE (by default the values are normalized).

As an example, the CoDiNA package contains 4 datasets from a Cancer study, GSE4290 (Sun et al. (2006)). Each one of this datasets was previously normalized, the control quality was done for the genes and the networks were calculate using the wTO package (Morselli Gysi et al. (2017); Morselli Gysi et al. (2017)). Each dataset consists of the Gene names and the weight only for the significative interactions and filtered for a wTO value of |0.3|.

Using the wTO output for CoDiNA

The output from the wTO package can be easily used as input for CoDiNA.

#> Loading required package: wTO
#> Loading required package: CoDiNA
#> Loading required package: magrittr

wTO_out = = Microarray_Expression1, n = 100)
#> There are 268 overlapping nodes, 268 total nodes and 18 individuals.
#> This function might take a long time to run. Don't turn off the computer.
#> ....................................................................................................Done!

wTO_filtered = subset(wTO_out, p.adjust(wTO_out$pval) < 0.05, select = c('Node.1', 'Node.2', 'wTO'))

Creating the Differential Network

To generate the differential network one can use the MakeDiffNet() function.

This function will return the Φ and Φ̃ classification for each one of the links. Connections that are assigned to α (a) are in agreement in all networks and it means that all networks possess that particular link with the same sign. Links classified as β (b) are the ones that also exist in all networks but at least one network contains it with a different sign. The category γ (g) contains links that does not exist in all networks, meaning that they are specific to at least one network.

This function also assigns the link into a sub-category. It is important mainly for the β and γ links to understand its differences or specificities. It is important to note that the first network is considered to be the reference for β links.

The output from this function is a data.frame containing the nodes, the original weights (or normalized), the Phi and Phi_tilde categories, a Group, which describes the sign or absence of the link, the Score_center (raw score), Score_Phi (normalized score by Φ), Score_Phi_tilde (normalized score by Φ̃), Score_internal (score of the link to its theoretical category). The first 3 scores, should be closer to 1, while for the last one, the closer to 0 the better.

DiffNet = MakeDiffNet(Data = list(CTR, OLI, AST), Code = c('CTR', 'OLI', 'AST'))
#> Starting now.
#> CTR contains 17471 edges and 1022 nodes.
#> OLI contains 64791 edges and 1697 nodes.
#> AST contains 3384 edges and 1002 nodes.
#> Total of nodes: 442
#> Total of edges: 82558
#> Coding correlations.
#> Total of edges (inside the cutoff): 15950
#> Starting Phi categorization.
#> Coding the groups.
#> Recode is done!

#> Nodes 441 
#> Links 15950

print(DiffNet) %>% head()
#> Nodes 441 
#> Links 15950
#>   Node.1 Node.2        CTR        OLI AST Phi Phi_tilde            Group
#> 1   CTCF NKX6-3 -0.8861789 -0.7756813   0   g g.CTR.OLI  -CTR,-OLI,NoAST
#> 2   IRF3 NKX6-3 -0.8520325  0.0000000   0   g     g.CTR -CTR,NoOLI,NoAST
#> 3 NKX6-3    TDG -0.9040650 -0.8385744   0   g g.CTR.OLI  -CTR,-OLI,NoAST
#> 4  BUD31 NKX6-3 -0.8016260 -0.7484277   0   g g.CTR.OLI  -CTR,-OLI,NoAST
#> 5  HMGN3 NKX6-3 -0.8878049 -0.8364780   0   g g.CTR.OLI  -CTR,-OLI,NoAST
#> 6 NKX6-3  PUF60 -0.9479675  0.0000000   0   g     g.CTR -CTR,NoOLI,NoAST
#>   Score_center Score_Phi Score_Phi_tilde Score_internal
#> 1    0.8327648 0.5467547       0.5235928     0.17786809
#> 2    0.8520325 0.5989745       0.5937500     0.14796748
#> 3    0.8719348 0.6529143       0.6723478     0.13278127
#> 4    0.7754832 0.3915083       0.3060555     0.22654014
#> 5    0.8625233 0.6274069       0.6366059     0.14022695
#> 6    0.9479675 0.8589800       0.8571429     0.05203252

Clustering the nodes into Φ and Φ̃ categories

Because exclusively the information about the links is not enough to define a network, it is necessary to define the nodes accordingly to its Φ and Φ̃ categories. To do so, the function ClusterNodes() can be used. The input for this function is DiffNet, that is the output from the MakeDiffNet(), besides the external and internal cutoffs. The external cutoff is applied to the normalized Φ̃ Score, while the internal cutoff is applied to the internal Score.

The suggested values for the internal and external cutoffs are the median or the first and third quantiles of the internal and Φ̃ scores, depending on how conservative the network should be.

Using the median:

int_C = quantile(DiffNet$Score_internal, 0.5)
ext_C = quantile(DiffNet$Score_Phi, 0.5)

Nodes_Groups = ClusterNodes(DiffNet = DiffNet, cutoff.external = ext_C, cutoff.internal = int_C)
#>     g.AST     g.CTR g.CTR.OLI     g.OLI g.OLI.AST         U 
#>        11       213         2       125         1        66

Using the first and third quantile:

int_C = quantile(DiffNet$Score_internal, 0.25)
ext_C = quantile(DiffNet$Score_Phi, 0.75)

Nodes_Groups = ClusterNodes(DiffNet = DiffNet, cutoff.external = ext_C, cutoff.internal = int_C)
#> g.AST g.CTR g.OLI     U 
#>     8   188    64    80

Plotting the network

The visualization of the final network can be quickly done with plot. The layout of the network can be also determined from a variety that is implemented in igraph package, the Make_Cluster argument allows the nodes to be clusterized according to many clustering algorithms that are implemented in igraph can be used. The final graph can be exported as an HTML or as png. The argument path saves the network in the given path.

The plot returns the nodes and its information.

int_C = quantile(DiffNet$Score_internal, 0.25)
ext_C = quantile(DiffNet$Score_Phi, 0.75)

Graph = plot(DiffNet, cutoff.external = ext_C, cutoff.internal = int_C, layout = 'layout_components', path = 'Vis.html')
#> Vis.html

The graph can also be exported as an igraph object, that can be further plotted.

g = as.igraph(Graph) 

#> Loading required package: igraph
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:CoDiNA':
#>     as.igraph, normalize
#> The following objects are masked from 'package:stats':
#>     decompose, spectrum
#> The following object is masked from 'package:base':
#>     union

plot(g, layout = layout.fruchterman.reingold(g), vertex.label = NA)


Morselli Gysi, Deisy, Andre Voigt, Tiago de Miranda Fragoso, Eivind Almaas, and Katja Nowick. 2017. wTO: Computing Weighted Topological Overlaps (wTO) & Consensus wTO Network.

Morselli Gysi, Deisy, Andre Voigt, Tiago de Miranda Fragoso, Eivind Almaas, and Katja Nowick. 2017. “WTO: An R Package for Computing Weighted Topological Overlap and Consensus Networks with an Integrated Visualization Tool.” arXiv Preprint arXiv:1711.04702.

Sun, Lixin, Ai-Min Hui, Qin Su, Alexander Vortmeyer, Yuri Kotliarov, Sandra Pastorino, Antonino Passaniti, et al. 2006. “Neuronal and Glioma-Derived Stem Cell Factor Induces Angiogenesis Within the Brain.” Cancer Cell 9 (4). Elsevier: 287–300.