Installation of add-on packages downloaded from this site

This is a short description of the installation of the packages you can download from the main site. For more details, please take a look at the manuals provided by the R project.


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:

install.packages(c("matrixStats", "Hmisc", "splines", "foreach", "doParallel", "fastcluster", "dynamicTreeCut", "survival")
biocLite(c("GO.db", "preprocessCore", "impute"))

If you plan on using annotation capabilities (such as GOenrichmentAnalysis), we also recommend installing Bioconductor annotation packages. This can be accomplished by the following R commands:

orgCodes = c("Hs", "Mm", "Rn", "Pf", "Sc", "Dm", "Bt", "Ce", "Cf", "Dr", "Gg");
orgExtensions = c(rep(".eg", 4), ".sgd", rep(".eg", 6));
packageNames = paste("org.", orgCodes, orgExtensions, ".db", sep="");

biocLite(c("GO.db", "KEGG.db", "topGO", packageNames, "hgu133a.db", "hgu95av2.db", "annotate", "hgu133plus2.db", "SNPlocs.Hsapiens.dbSNP.20100427", "minet", "OrderedList"))

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.

Installation of the WGCNA package

Installation of the package is simple. Download the appropriate package file from the download page and save it in a directory of your choice. Run an R session as a user with sufficient privileges to install software (see below if you don't have the requisite privileges). At the prompt, type (replace path/to/file with the directory and filename of the downloaded package):

install.packages("path/to/file", repos = NULL, lib=.Library)

For Mac users: if you are compiling and installing a source package, add the argument

type = "source"

to the install.packages command. The additional argument should not be supplied if you are installing the pre-compiled binary bundle (.tgz file). The packages should be automatically unpacked and installed. If you have trouble installing the package, make sure you have installed Apple Xcode Tools, including Xcode command line tools, available from, installed. See the R documentation on, in particular this section for more details on installation of source packages on OS X.

If you do not have sufficient privileges, you can either (1) ask your system administrator to install the packages for you, or (2) create your own personal R library. You may also wish to create a separate R library to hold oder versions of these and/or other packages. To do that, create a directory on your system where you want the library to reside. Then run an R session, and at the prompt type (replace path/to/file with the directory and filename of the downloaded package and path/to/library with your library directory)

install.packages("path/to/file", repos = NULL, lib = "path/to/library")

Note that if you chose to go this route, you will need to specify your library location every time you load the package, by using

library(package, lib.loc = "path/to/library")

instead of the usual


In particular, you will need to modify in this way the example scripts provided at the main page.


Back to main page

Peter Langfelder, January 2015.