The WGCNA R software package is a comprehensive collection of R functions for performing various aspects of weighted correlation network analysis. The package includes functions for network construction, module detection, gene selection, calculations of topological properties, data simulation, visualization, and interfacing with external software. Along with the R package we also present R software tutorials. While the methods development was motivated by gene expression data, the underlying data mining approach can be applied to a variety of different settings.
Readers wishing to learn about the theory and published applications of WGCNA are invited to
visit the WGCNA
main page.
R Tutorials
A comprehensive set of tutorials
that illustrate various aspects of WGCNA is available. We offer not only introductory tutorials that
introduce basic functionality of the package, but also more advanced analyses in which we used the WGCNA
package in our own research.
Click here to access the tutorial page.
Further reading
Peter Langfelder occasionally writes about WGCNA features and other topics
relating to data analysis. The articles are written for a general audience and try to avoid deep technical details.
We also have a few
technical reports that discuss a
selected deeply technical aspects of the WGCNA methodology - these are more mathematical and targeted primarilly to
die-hard statistician geeks.
Automatic installation from CRAN
The WGCNA package is now available from the Comprehensive R Archive Network (CRAN), the standard repository for R add-on packages. Currently, some of the required packages is only available from Bioconductor and need to be installed using Bioconductor's installation tools. The easiest way to do this is
The first command (install.packages("BiocManager")
) can be skipped if the package
BiocManager
is already installed.
This will install the WGCNA package and all necessary dependencies. The catch is that this only installs the newest version of WGCNA if your R version is also the newest (minor) version. Users using older versions of R will need to follow the manual download and installation instructions below.
Note for Mac users:
CRAN occasionally fails to compile the WGCNA package for
Mac OS X. This leads to the error message "Package WGCNA is not available..." when calling
BiocManager::install()
. If this occurs,
please download the binary version from here and follow the installation
instructions (or, if you are able to compile packages locally, download the source and install that).
Note of caution: The newest versions of WGCNA is available from CRAN only for the current R version and (usually) one older version. For example, if your R version is 3.2.1 and the current R version on CRAN is 3.5.0, the automatic installation and update will not use the newest version of WGCNA. Please update your R to the newest version or use the manual download below.
Problems installing or using the package? Please see our list of frequently asked
questions. Your problem and the solution may already be posted there.
Manual download and installation
Please follow these steps only if the automatic package installation above does not work.
Prerequisites:
The current version of the WGCNA package will only work with R version 3.0.0 and higher. If you have an older version of R, please upgrade your R.
The WGCNA package requires the following packages to be installed: stats, grDevices, utils, matrixStats (0.8.1 or higher), Hmisc, splines, foreach, doParallel, fastcluster, dynamicTreeCut, survival, parallel, preprocessCore, GO.db, impute, and AnnotationDbi. If your system does not have them installed, the easiest way to install them is to issue the following command at the R prompt:
If you use an old R version for which BiocManager is not available, you can try the following:
Please note that GO enrichment calculations in WGCNA are deprecated; we recommend using the R package anRichment which provides replacement for WGCNA functions GOenrichmentAnalysis() and
userListEnrichment().
If you run an older version of R, the above may not install the
newest version of the dynamicTreeCut
package. Should you encounter this problem, please manually download and install
dynamicTreeCut from this web page.
R package download and installation: Package WGCNA_1.70-3 (last updated 2021/11/28) is available here as source code and several pre-compiled versions for various platforms. In general it is preferable to download the source and compile the package locally; however, if this is not practical, please select an appropriate compiled version.
The package version numbers follow the format packageName_major.minor-revision. Minor versions typically add or change some functionality; revisions typically contain bugfixes or minor enhancements.
Should you discover bugs (of which there are most likely plenty), please report them to Peter Langfelder.
The WGCNA as an analysis method is described in
The package implementation is described in the article
If you use any q-value (FDR) calculations, please also cite at least one of the following articles:
If you use the If you use module preservation calculations, please cite
If you use functions The package is currently maintained by Peter Langfelder.
Problems installing or using the package
Please see our list of Frequently Asked Questions (and frequently given answers);
the solution to your problem may lie there. In particular, you can find answers about spurious Mac
errors, compatibility problems when upgrading WGCNA, and others.
If you still cannot solve the problem, email Peter
Langfelder.
Old versions of R package WGCNA
Older version of the packages presented on this page are available here.
Citing the WGCNA package
If you use WGCNA in published work, please cite it to properly credit people who have created it.
collapseRows
function to summarize/convert probe-level data to gene-level
data, please cite
rgcolors.func
, plotCor
, plotMat
,
stat.bwss
, or stat.diag.da
, please also cite the article
Acknowledgments
The core of the functions and other code was written by Peter Langfelder and Steve Horvath, partly
based on older code written by Steve Horvath and Bin Zhang. Multiple people contributed additional code,
most prominently Jeremy Miller, Chaochao (Ricky) Cai, Lin Song, Jun Dong, and Andy Yip. The package also
contains code adapted from external packages that were either orphaned (such as package sma
) or
their development has made the code difficult to use in WGCNA (such as package qvalue
).
A big thanks goes out to people who continue report the many bugs in the package.