Optimize weighted gene co-expression network analysis: fast calculate unsigned Topological Overlap Matrix from unsigned or signed Adjacency Matrix
Biomolecular networks are usually scale-free hierarchical networks. The weighted gene co-expression network analysis (WGCNA) package in R language treats gene co-expression networks as undirected scale-free hierarchical weighted networks. WGCNA uses an Adjacency Matrix to store a network, next calculates the Topological Overlap Matrix (TOM), and then gets the modules (sub-networks), each module corresponds to a certain biological function. The most time-consuming step of WGCNA is to calculate TOM from the Adjacency Matrix in a single thread. This paper changes the single-threaded algorithm of the TOM to a multi-threaded algorithm (only for the calculation of commonly used unsigned or signed Adjacency Matrix to unsigned TOM). This paper uses Rcpp to make R call a C++ function, then C++ uses OpenMP to open multiple threads, and calculates TOM from the Adjacency Matrix. On Shared-memory MultiProcessor systems, the calculation time decreases as the number of CPU cores increases. The algorithm of this paper can promote the application of WGCNA on large data sets, and help other research fields to find sub-networks in undirected scale-free hierarchical weighted networks.
The codes here can run on Linux and Windows systems. It’s better to use a CPU cooler with a fast fan speed to avoid the CPU running at reduced frequency due to high temperature.
install.packages( c("Rcpp" , "RcppArmadillo") )You need to use the WGCNA package to calculate the unsigned or signed Adjacency Matrix from the expression matrix. "unsigned" is the default value of the parameter named type of the "adjacency" function in the WGCNA. Then you can run the R codes that you downloaded from here. Next you will get the TOM with TOMtype="unsigned" and TOMDenom="min". TOMtype="unsigned" and TOMDenom="min" are the default parameters in the "TOMsimilarity" function of the WGCNA.
Details about Weighted gene co-expression network analysis(WGCNA) of R language:
https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/
Details about the usage of original TOMsimilarity() function in WGCNA
https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-02-networkConstr-man.pdf
Details about mathematical formulas of the Topological Overlap Matrix (TOM):
https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/TechnicalReports/index.html