BACKGROUND
correlation networks are increasingly being used in biology to analyze large, high-dimensional data sets.
correlation networks are constructed on the basis of correlations between quantitative measurements that can be described by an n × m matrix x =  where the row indices correspond to network nodes  and the column indices  correspond to sample measurements:
x==
we refer to the i-th row xi as the i-th node profile across m sample measurements.
sometimes a quantitative measure  is provided for the columns of x. for example, t =  could measure survival time or it could be a binary indicator variable .
abstractly speaking, we define a sample trait t as a vector with m components that correspond to the columns of the data matrix x. a sample trait can be used to define a node significance measure.
for example, a trait-based node significance measure can be defined as the absolute value of the correlation between the i-th node profile xi and the sample trait t:
gsi = |cor|.
alternatively, a correlation test p-value  <cit>  or a regression-based p-value for assessing the statistical significance between xi and the sample trait t can be used to define a p-value based node significance measure, for example by defining
gsi = -log pi.
the rationale behind correlation network methodology is to use network language to describe the pairwise relationships  between the rows of x .
although other statistical techniques exist for analyzing correlation matrices, network language is particularly intuitive to biologists and allows for simple social network analogies.
correlation networks can be used to address many analysis goals including the following.
first, correlation networks can be used to find clusters  of interconnected nodes.
thus, a network module is a set of rows of x  which are closely connected according to a suitably defined measure of interconnectedness.
a second analysis goal is to summarize the node profiles of a given module by a representative, e.g.
a highly connected hub node, which is centrally located in the module.
focusing the analysis on module or their representatives amounts to a network-based data reduction method.
relating modules instead of nodes to a sample trait can alleviate the multiple testing problem.
a third analysis goal is to identify 'significant' modules.
toward this end, a node significance measure can be used to identify modules with high average node significance .
a fourth analysis goal is to annotate all network nodes with respect to how close they are to the identified modules.
this can be accomplished by defining a fuzzy measure of module memberships that generalizes the binary module membership indicator to a quantitative measure.
fuzzy measures of module membership can be used to identify nodes that lie intermediate between and close to two or more modules.
a fifth analysis goal is to define the network neighborhood of a given seed set of nodes.
intuitively speaking, a neighborhood is composed of nodes that are highly connected to a given set of nodes.
thus, neighborhood analysis facilitates a guilt-by-association screening strategy for finding nodes that interact with a given set of interesting nodes.
a sixth analysis goal is to screen for nodes based on node screening criteria which can be based on a node significance measure, on module membership information, on network topological properties , etc.
a seventh analysis goal is to contrast one network with another network.
this differential network analysis can be used to identify changes in connectivity patterns or module structure between different conditions.
an eighth analysis goal is to find shared modules between two or more networks .
since by definition consensus modules are building blocks in multiple networks, they may represent fundamental structural properties of the network.
the above incomplete enumeration of analysis goals shows that correlation networks can be used as a data exploratory technique  and as a screening method.
for example, correlation networks can be used to screen for modules and intramodular hubs that relate to a sample trait.
correlation networks allow one to generate testable hypotheses that should be validated in independent data or in designed validation experiments.
gene co-expression networks
in the following, we focus on gene co-expression networks which represent a major application of correlation network methodology.
co-expression networks have been found useful for describing the pairwise relationships among gene transcripts  <cit> .
in co-expression networks, we refer to nodes as 'genes', to the node profile xi as the gene expression profile, and to the node significance measure gsi as the gene significance measure.
a glossary of important network-related terms can be found in table  <dig>  here we introduce an r software package that summarizes and extends our earlier work on weighted gene co-expression network analysis   <cit> .
wgcna has been used to analyze gene expression data from brain cancer  <cit> , yeast cell cycle  <cit> , mouse genetics  <cit> , primate brain tissue  <cit> , diabetes  <cit> , chronic fatigue patients  <cit>  and plants  <cit> .
while these publications have made r software code available in various forms, there is a need for a comprehensive r package that summarizes and standardizes methods and functions.
to address this need, we introduce the wgcna r package which also includes enhanced and novel functions for co-expression network analysis.
RESULTS
overview of functions included in the wgcna package
the wgcna package contains a comprehensive set of functions for performing a correlation network analysis of large, high-dimensional data sets.
functions in the wgcna package can be divided into the following categories:  <dig>  network construction;  <dig>  module detection;  <dig>  module and gene selection;  <dig>  calculations of topological properties;  <dig>  data simulation;  <dig>  visualization;  <dig>  interfacing with external software packages.
an exhaustive list of implemented functions together with detailed descriptions is provided in the r package manual posted on our web site.
here we briefly outline the main functionality of the package and highlight new contributions.
category 1: functions for network construction
a network is fully specified by its adjacency matrix aij, a symmetric n × n matrix with entries in  <cit>  whose component aij encodes the network connection strength between nodes i and j. to calculate the adjacency matrix, an intermediate quantity called the co-expression similarity sij is first defined.
the default method defines the co-expression similarity sij as the absolute value of the correlation coefficient between the profiles of nodes i and j:
sij = |cor|.
the wgcna package also implements alternative co-expression measures, e.g.
more robust measures of correlation .
a signed co-expression measure can be defined to keep track of the sign of the co-expression information.
for convenience, we define the co-expression similarity measure such that it takes on values in  <cit> .
using a thresholding procedure, the co-expression similarity is transformed into the adjacency.
an unweighted network adjacency aij between gene expression profiles xi and xj can be defined by hard thresholding the co-expression similarity sij as
aij={1if sij≥τ;0otherwise,
where τ is the "hard" threshold parameter.
thus, two genes are linked  if the absolute correlation between their expression profiles exceeds the  threshold τ. the hard-thresholding procedure is implemented in the function signumadjacencyfunction.
while unweighted networks are widely used, they do not reflect the continuous nature of the underlying co-expression information and may thus lead to an information loss.
in contrast, weighted networks allow the adjacency to take on continuous values between  <dig> and  <dig>  a weighed network adjacency can be defined by raising the co-expression similarity to a power  <cit> :
aij=sijβ,
with β ≥  <dig>  the function adjacency calculates the adjacency matrix from expression data.
the adjacency in equation  <dig> implies that the weighted adjacency aij between two genes is proportional to their similarity on a logarithmic scale, log = β × log.
adjacency functions for both weighted and unweighted networks require the user to choose threshold parameters, for example by applying the approximate scale-free topology criterion  <cit> .
the package provides functions picksoftthreshold, pickhardthreshold that assist in choosing the parameters, as well as the function scalefreeplot for evaluating whether the network exhibits a scale free topology.
figure 2a shows a plot identifying scale free topology in simulated expression data.
category 2: functions for module detection
once the network has been constructed, module detection is often a logical next step.
modules are defined as clusters of densely interconnected genes.
several measures of network interconnectedness are described in  <cit> .
as default, we we use the topological overlap measure  <cit>  since it has worked well in several applications.
wgcna identifies gene modules using unsupervised clustering, i.e.
without the use of a priori defined gene sets.
the user has a choice of several module detection methods.
the default method is hierarchical clustering using the standard r function hclust  <cit> ; branches of the hierarchical clustering dendrogram correspond to modules and can be identified using one of a number of available branch cutting methods, for example the constant-height cut or two dynamic branch cut methods  <cit> .
in figure 2c we show a network heatmap plot  of a gene network together with the corresponding hierarchical clustering dendrograms and the resulting modules.
figure 2b provides an alternate visualization of the module structure via a multi-dimensional scaling plot .
one drawback of hierarchical clustering is that it can be difficult to determine how many  clusters are present in the data set.
although the height and shape parameters of the dynamic tree cut method provide improved exibility for branch cutting and module detection, it remains an open research question how to choose optimal cutting parameters or how to estimate the number of clusters in the data set  <cit> .
while our default parameter values have worked well in several applications, in practice we recommend to carry out a cluster stability/robustness analysis.
a co-expression module may reflect a true biological signal  or it may reflect noise .
to test whether the identified modules are biologically meaningful, gene ontology information  can be used.
toward this end, we provide an r tutorial that describes how to interface the wgcna package with relevant external software packages and databases.
summarizing the profiles of a module
several options have been implemented for summarizing the gene expression profiles of a given module.
for example, the function moduleeigengenes represents the module expressions of the q-th module by the module eigengene e, defined as the first principal component of the expression matrix.
the eigengene e can be thought of as a weighted average expression profile.
eigengene calculation incorporates imputation of missing values implemented in the package impute  <cit> .
alternatively, the user can use the intramodular connectivity measure to define the most highly connected intramodular hub gene as the module representative.
one can show that intramodular hub genes are highly correlated with the module eigengene  <cit> .
fuzzy measure of module membership
hierarchical clustering and most other standard clustering methods such as partitioning around medoids   <cit>  result in a binary module assignment, i.e.
a node is either in or outside of a module.
in some applications it may be advantageous to define a continuous, fuzzy measure of module membership for all nodes.
such measure is particularly useful to identify nodes that lie near the boundary of a module, or nodes that are intermediate between two or more modules.
as explained in detail in  <cit> , the module membership of node i in module q can be defined as
kcor,i:=cor),
where xi is the profile of node i and e is the module eigengene of module q. the module membership measure kcor,i lies in  and specifies how close node i is to module q, q =  <dig>  .
.
., q. the larger |kcor,i|, the more similar node i is to the eigengene of the q-th module.
in some publications  <cit> , kcor,i is referred to as signed module eigengene  based connectivity measure kme.
this is the reason why we named the corresponding r function signedkme.
automatic block-wise module detection
many microarray gene expression measurements report expression levels of tens of thousands of distinct genes .
building and analyzing a full network among such a large number of nodes can be computationally challenging because of memory size and processor speed limitations.
the wgcna package contains several improvements that address this challenge.
the function blockwisemodules is designed to handle network construction and module detection in large data sets.
the function first pre-clusters nodes into large clusters, referred to as blocks, using a variant of k-means clustering .
next, hierarchical clustering is applied to each block and modules are defined as branches of the resulting dendrogram.
to synthesize the module detection results across blocks, an automatic module merging step  is performed that merges modules whose eigengenes are highly correlated.
the time and memory savings of the block-wise approach are substantial: a standard, single-block network analysis of n nodes requires o memory and o calculations, while the block-wise approach with block size nb requires only o memory and o calculations, making an analysis of say  <dig>  <dig> genes in blocks of  <dig>  <dig> feasible on a standard computer.
consensus module detection
when dealing with multiple adjacency matrices representing different networks, it can be interesting to find consensus modules, defined as modules that are present in all or most networks  <cit> .
intuitively, two nodes should be connected in a consensus network only if all of the input networks agree on that connection.
this naturally suggest to define the consensus network similarity between two nodes as the minimum of the input network similarities.
in certain cases it may be useful to replace minimum by a suitable quantile  since the resulting measure may be more robust.
consensus module detection can be performed step-by-step for maximum control and exibility, or in one step using the function blockwiseconsensusmodule that calculates consensus modules across given data sets in a block-wise manner analogous to the block-wise module detection in a single data set.
category 3: functions for module and gene selection
finding biologically or clinically significant modules and genes is a major goal of many co-expression analyses.
the definition of biological or clinical significance depends on the research question under consideration.
abstractly speaking, we define a gene significance measure as a function gs that assigns a non-negative number to each gene; the higher gsi the more biologically significant is gene i. in functional enrichment analysis, a gene significance measure could indicate pathway membership.
in gene knock-out experiments, gene significance could indicate knock-out essentiality.
a microarray sample trait t can be used to define a trait-based gene significance measure as the absolute correlation between the trait and the expression profiles, equation  <dig>  a measure of module significance can be defined as average gene significance across the module genes .
when dealing with a sample trait t, a measure of statistical significance between the module eigengene e and the trait t can be defined, for example, using correlation  or a p-value  obtained from a univariate regression model between e and t. modules with high trait significance may represent pathways associated with the sample trait.
genes with high module membership in modules related to traits  are natural candidates for further validation  <cit> .
category 4: functions for studying topological properties
many topological properties of networks can be succinctly described using network concepts, also known as network statistics or indices  <cit> .
network concepts include whole network connectivity , intramodular connectivity, topological overlap, the clustering coefficient, density etc.
differential analysis of network concepts such as intramodular connectivity may reveal regulatory changes in gene expressions  <cit> .
the wgcna package implements several functions, such as softconnectivity, intramodularconnectivity, tomsimilarity, clustercoef, networkconcepts, for computing these network concepts.
basic r functions can be used to create summary statistics of these concepts and for testing their differences across networks.
network concepts for measuring cluster structure
gene clustering trees and tom plots that visualize interconnectivity patterns often suggest the presence of large modules.
network theory offers a wealth of intuitive network concepts for describing the pairwise relationships among genes that are depicted in cluster trees and heat maps  <cit> .
to illustrate this point, we describe two network concepts in the following.
by visual inspection of figures 2c and 4b, genes appear to be highly interconnected, e.g.
turquoise module genes form a reddish square in the tom plot.
this property of dense connections among the genes of module q can be measured using the concept of module density, which is defined as the average adjacency of the module genes:
density)=∑i∑j≠iaijn−1)
where a denotes the n × n adjacency matrix corresponding to the sub-network formed by the genes of module q. another useful concept is the clustering coefficient of gene i, which is a measure of 'cliquishness'  <cit> .
specifically,
clustercoefi=∑l≠i∑m≠i,lailalmami{2−∑l≠i2}.
in unweighted networks, clustercoefi equals  <dig> if and only if all neighbors of gene i are also linked to each other.
for weighted networks,  <dig> ≤ aij ≤  <dig> implies that  <dig> ≤ clustercoefi ≤  <dig>  <cit> .
the mean clustering coefficient has been used to measure the extent of module structure present in a network  <cit> .
category 5: functions for simulating microarray data with modular structure
simple yet sufficiently realistic simulated data is often important for evaluation of novel data mining methods.
the wgcna package includes simulation functions simulatedatexpr, simulatemultiexpr, simulatedatexpr5modules that result in expression data sets with a customizable modular  structure.
the user can choose the modular structure by specifying a set of seed eigengenes, one for each module, around which each module is built.
module genes are simulated to exhibit progressively lower correlations with the seed which leads to genes with progressively lower intramodular connectivity.
the user can specify module sizes and the number of background genes, i.e.
genes outside of the modules.
the seed eigengenes can be simulated to reflect dependence relationships between the modules .
category 6: visualization functions
module structure and network connections in the expression data can be visualized in several different ways.
for example, the co-expression module structure can be visualized by heatmap plots of gene-gene connectivity that can be produced using the function tomplot.
examples are presented in figures 2c and 4b.
an alternative is a multi-dimensional scaling plot; an example is presented in figure 2b.
relationships among modules can be summarized by a hierarchical clustering dendrogram of their eigengenes, or by a heatmap plot of the corresponding eigengene network , illustrated in figures 3c, d, and 4c, d. the package includes several additional functions designed to aid the user in visualizing input data and results.
these functions rely on basic plotting functions provided in r and the packages sma  <cit>  and fields  <cit> .
category 7: functions for interfacing with other software packages
to enhance the integration of wgcna results with other network visualization packages and gene ontology analysis software, we have created several r functions and corresponding tutorials.
for example, our r functions exportnetworktovisant and exportnetworktocytoscape allow the user to export networks in a format suitable for visant  <cit>  and cytoscape  <cit> , respectively.
our online r tutorials also show how to interface wgcna results with gene ontology packages available directly in r, e.g.
gosim  <cit> .
many gene ontology based functional enrichment analysis software programs such as david  <cit> , amigo  <cit> , webgestalt  <cit>  simply take lists of gene identifiers as input.
ingenuity pathway analysis allows the user to input gene expression data or gene identifiers.
mouse data application
as an example of the type of analysis one can perform with wgcna, we describe a network analysis of liver expression data from female mice.
the data and biological findings of this analysis have been described in  <cit> .
briefly, mrna levels in female mouse livers were measured by microarrays with over  <dig>  probe sets.
in addition to the expression data, multiple physiological and metabolic traits were measured.
for computational reasons, the original analysis presented in  <cit>  was restricted to  <dig> most connected genes, and for simplicity we will work with the same set of genes .
while we do use the same data, the module detection methods are slightly different and the results are similar but not the same.
the code used to perform this analysis is part of the tutorials posted on our webpage.
the network and the  <dig> identified modules are depicted in figures 4a, b. to understand the physiologic significance of the modules, we correlated the  <dig> module eigengenes with physiological traits such as body weight, cholesterol level, insulin level.
the full module-trait correlation table is presented in the accompanying tutorial.
in the following, we will only consider mouse body weight as sample trait.
the module eigengenes of the following three modules were highly correlated with body weight: brown , red , and salmon .
we used the online software david  <cit>  to determine whether the three body weight related modules were significantly enriched with regard to known gene ontologies.
the brown module is significantly enriched in categories "glycoprotein"  and "signal" .
the red module is enriched in "cell cycle"  and "chromosome" .
the salmon module is most significantly enriched in the category "lipid synthesis" .
overall, the high enrichment scores suggest that these modules are indeed biologically meaningful.
to study the relationships between modules, we correlate their eigengenes.
in general, relationships between modules can be studied by using correlation networks between eigengenes .
in these meta-networks between modules, the adjacency between modules reflects the correlation between the module eigengenes, and modules of eigengenes are referred to as meta-modules  <cit> .
a sample trait such as body weight can be incorporated as an additional node of the eigengene network.
the adjacency between the sample trait and an eigengene is sometimes referred to as the eigengene significance  <cit> .
figures 4c, d depict the eigengene network using a dendrogram  and a heatmap plot.
we find that eigengenes may exhibit highly significant correlations, e.g.
the red and brown modules are highly correlated.
groups of correlated eigengenes corresponds to meta-modules and are recognizable as branches of the eigengene dendrogram, and as reddish squares along the diagonal of the heatmap plot.
figures 4c indicates that there are four meta-modules .
body weight falls within the meta-module grouping together the blue, brown, red, salmon, and yellow modules.
in practice, it is difficult to determine whether the modules underlying a meta-module are truly distinct or whether they should be merged.
sometimes gene ontology information can provide some clues.
it is interesting to find centrally located intramodular hub genes in the body weight related modules since their expression profile represents that of the entire module  <cit> .
to find intramodular hub genes, one can use the module membership measure k, equation  <dig>  figure 4e shows a scatterplot between the body weight based gene significance measure gsi, equation  <dig> and module membership in the brown module.
the high correlation between gene significance and module membership implies that hubgenes in the brown module also tend to be highly correlated with body weight.
this suggests that both gene significance and module membership  can be combined in a systems biologic screening method for finding body weight related genes  <cit> .
figure 4f shows a visant plot among the most connected genes in the brown module.
this brief description illustrates how wgcna can lead to testable hypotheses that require validation in independent data sets.
a tutorial underlying this example and figure  <dig> can be found on our webpage.
tutorials
we provide a comprehensive set of online tutorials that guide the user through major steps of correlation network analysis.
the tutorials provide r code the user can copy-and-paste into an r session, along with comments and explanations of both the input and output.
the code is organized into short sections, each of which addresses a particular task.
in particular, the tutorials cover the following topics: correlation network construction, step-by-step and automatic module detection, consensus module detection, eigengene network analysis, differential network analysis, interfacing with external software packages, and data simulation.
the tutorials use both simulated and real gene expression data sets.
discussion
the wgcna package complements other network related packages for r, such as the general network structures in bioconductor  <cit> , gene network enrichment analysis  <cit> , functional analysis of gene co-expression networks  <cit> , and others.
while most of the existing packages focus only on unweighted networks, wgcna implements methods for both weighted and unweighted correlation networks.
wgcna can be used as a data exploratory tool or as a gene screening  method.
for example, wgcna can be used to explore the module  structure in a network, to measure the relationships between genes and modules , to explore the relationships among modules , and to rank-order genes or modules .
wgcna can be used to generate testable hypotheses for validation in independent data sets.
for example, wgcna may suggest that a module  is associated with a disease outcome.
since correlation networks are based on correlations between quantitative variables, one can use a correlation test p-value  <cit>  or a regression-based p-value for assessing the statistical significance between pairs of variables.
for example, it is straightforward to attach a significance level to the fuzzy module membership measures kcor,i.
the relationship between standard microarray data mining techniques and gene co-expression network analysis is discussed in  <cit> .
users should be aware of the limitations of the methods implemented in the wgcna package.
first, wgcna assumes that the microarray data have been properly pre-processed and normalized.
to normalize the expression data, several r functions have been implemented in the bioconductor packages  <cit> .
although all normalization methods are mathematically compatible with wgcna, we recommend to use the biologically most meaningful normalization method with respect to the application under consideration.
second, similar to most other data mining methods, the results of wgcna can be biased or invalid when dealing with technical artefacts, tissue contaminations, or poor experimental design.
third, although several co-expression module detection methods are implemented, the package does not provide means to determine which method is best.
while the default hierarchical clustering methods have performed well in several real data applications, it would be desirable to compare these and other methods on multiple real benchmark data sets.
fourth, this package is limited to undirected networks.
methods for orienting edges and constructing directed networks have been presented in the literature, for example in  <cit> .
CONCLUSIONS
the wgcna r package provides a comprehensive set of functions for performing weighted correlation network analysis.
the wgcna package can also be used to describe the correlation structure between gene expression profiles, image data, genetic marker data, proteomics data, and other high-dimensional data.
availability and requirements
project name: wgcna r package
project home page:
operating system: platform independent
programming language: r
licence: gnu gpl 3
authors' contributions
both authors jointly developed the methods and wrote the article.
pl packaged the functions into an r package.
both authors read and approved the final manuscript.

 correlation networks are increasingly being used in biology to analyze large, high-dimensional data sets. correlation networks are constructed on the basis of correlations between quantitative measurements that can be described by an n × m matrix x = where the row indices correspond to network nodes and the column indices correspond to sample measurements: x== we refer to the i-th row xi as the i-th node profile across m sample measurements. sometimes a quantitative measure is provided for the columns of x. for example, t = could measure survival time or it could be a binary indicator variable. abstractly speaking, we define a sample trait t as a vector with m components that correspond to the columns of the data matrix x. a sample trait can be used to define a node significance measure. for example, a trait-based node significance measure can be defined as the absolute value of the correlation between the i-th node profile xi and the sample trait t: gsi = |cor|. alternatively, a correlation test p-value or a regression-based p-value for assessing the statistical significance between xi and the sample trait t can be used to define a p-value based node significance measure, for example by defining gsi = -log pi. the rationale behind correlation network methodology is to use network language to describe the pairwise relationships between the rows of x. although other statistical techniques exist for analyzing correlation matrices, network language is particularly intuitive to biologists and allows for simple social network analogies. correlation networks can be used to address many analysis goals including the following. first, correlation networks can be used to find clusters of interconnected nodes. thus, a network module is a set of rows of x which are closely connected according to a suitably defined measure of interconnectedness. a second analysis goal is to summarize the node profiles of a given module by a representative, e.g. a highly connected hub node, which is centrally located in the module. focusing the analysis on module or their representatives amounts to a network-based data reduction method. relating modules instead of nodes to a sample trait can alleviate the multiple testing problem. a third analysis goal is to identify'significant' modules. toward this end, a node significance measure can be used to identify modules with high average node significance. a fourth analysis goal is to annotate all network nodes with respect to how close they are to the identified modules. this can be accomplished by defining a fuzzy measure of module memberships that generalizes the binary module membership indicator to a quantitative measure. fuzzy measures of module membership can be used to identify nodes that lie intermediate between and close to two or more modules. a fifth analysis goal is to define the network neighborhood of a given seed set of nodes. intuitively speaking, a neighborhood is composed of nodes that are highly connected to a given set of nodes. thus, neighborhood analysis facilitates a guilt-by-association screening strategy for finding nodes that interact with a given set of interesting nodes. a sixth analysis goal is to screen for nodes based on node screening criteria which can be based on a node significance measure, on module membership information, on network topological properties, etc. a seventh analysis goal is to contrast one network with another network. this differential network analysis can be used to identify changes in connectivity patterns or module structure between different conditions. an eighth analysis goal is to find shared modules between two or more networks. since by definition consensus modules are building blocks in multiple networks, they may represent fundamental structural properties of the network. the above incomplete enumeration of analysis goals shows that correlation networks can be used as a data exploratory technique and as a screening method. for example, correlation networks can be used to screen for modules and intramodular hubs that relate to a sample trait. correlation networks allow one to generate testable hypotheses that should be validated in independent data or in designed validation experiments. gene co-expression networks in the following, we focus on gene co-expression networks which represent a major application of correlation network methodology. co-expression networks have been found useful for describing the pairwise relationships among gene transcripts. in co-expression networks, we refer to nodes as'genes', to the node profile xi as the gene expression profile, and to the node significance measure gsi as the gene significance measure. a glossary of important network-related terms can be found in table here we introduce an r software package that summarizes and extends our earlier work on weighted gene co-expression network analysis. wgcna has been used to analyze gene expression data from brain cancer, yeast cell cycle, mouse genetics, primate brain tissue, diabetes, chronic fatigue patients and plants. while these publications have made r software code available in various forms, there is a need for a comprehensive r package that summarizes and standardizes methods and functions. to address this need, we introduce the wgcna r package which also includes enhanced and novel functions for co-expression network analysis.  overview of functions included in the wgcna package the wgcna package contains a comprehensive set of functions for performing a correlation network analysis of large, high-dimensional data sets. functions in the wgcna package can be divided into the following categories: network construction; module detection; module and gene selection; calculations of topological properties; data simulation; visualization; interfacing with external software packages. an exhaustive list of implemented functions together with detailed descriptions is provided in the r package manual posted on our web site. here we briefly outline the main functionality of the package and highlight new contributions. category 1: functions for network construction a network is fully specified by its adjacency matrix aij, a symmetric n × n matrix with entries in whose component aij encodes the network connection strength between nodes i and j. to calculate the adjacency matrix, an intermediate quantity called the co-expression similarity sij is first defined. the default method defines the co-expression similarity sij as the absolute value of the correlation coefficient between the profiles of nodes i and j: sij = |cor|. the wgcna package also implements alternative co-expression measures, e.g. more robust measures of correlation. a signed co-expression measure can be defined to keep track of the sign of the co-expression information. for convenience, we define the co-expression similarity measure such that it takes on values in. using a thresholding procedure, the co-expression similarity is transformed into the adjacency. an unweighted network adjacency aij between gene expression profiles xi and xj can be defined by hard thresholding the co-expression similarity sij as aij={1if sij≥τ;0otherwise, where τ is the "hard" threshold parameter. thus, two genes are linked if the absolute correlation between their expression profiles exceeds the threshold τ. the hard-thresholding procedure is implemented in the function signumadjacencyfunction. while unweighted networks are widely used, they do not reflect the continuous nature of the underlying co-expression information and may thus lead to an information loss. in contrast, weighted networks allow the adjacency to take on continuous values between and a weighed network adjacency can be defined by raising the co-expression similarity to a power: aij=sijβ, with β ≥ the function adjacency calculates the adjacency matrix from expression data. the adjacency in equation implies that the weighted adjacency aij between two genes is proportional to their similarity on a logarithmic scale, log = β × log. adjacency functions for both weighted and unweighted networks require the user to choose threshold parameters, for example by applying the approximate scale-free topology criterion. the package provides functions picksoftthreshold, pickhardthreshold that assist in choosing the parameters, as well as the function scalefreeplot for evaluating whether the network exhibits a scale free topology. figure 2a shows a plot identifying scale free topology in simulated expression data. category 2: functions for module detection once the network has been constructed, module detection is often a logical next step. modules are defined as clusters of densely interconnected genes. several measures of network interconnectedness are described in. as default, we we use the topological overlap measure since it has worked well in several applications. wgcna identifies gene modules using unsupervised clustering, i.e. without the use of a priori defined gene sets. the user has a choice of several module detection methods. the default method is hierarchical clustering using the standard r function hclust; branches of the hierarchical clustering dendrogram correspond to modules and can be identified using one of a number of available branch cutting methods, for example the constant-height cut or two dynamic branch cut methods. in figure 2c we show a network heatmap plot of a gene network together with the corresponding hierarchical clustering dendrograms and the resulting modules. figure 2b provides an alternate visualization of the module structure via a multi-dimensional scaling plot. one drawback of hierarchical clustering is that it can be difficult to determine how many clusters are present in the data set. although the height and shape parameters of the dynamic tree cut method provide improved exibility for branch cutting and module detection, it remains an open research question how to choose optimal cutting parameters or how to estimate the number of clusters in the data set. while our default parameter values have worked well in several applications, in practice we recommend to carry out a cluster stability/robustness analysis. a co-expression module may reflect a true biological signal or it may reflect noise. to test whether the identified modules are biologically meaningful, gene ontology information can be used. toward this end, we provide an r tutorial that describes how to interface the wgcna package with relevant external software packages and databases. summarizing the profiles of a module several options have been implemented for summarizing the gene expression profiles of a given module. for example, the function moduleeigengenes represents the module expressions of the q-th module by the module eigengene e, defined as the first principal component of the expression matrix. the eigengene e can be thought of as a weighted average expression profile. eigengene calculation incorporates imputation of missing values implemented in the package impute. alternatively, the user can use the intramodular connectivity measure to define the most highly connected intramodular hub gene as the module representative. one can show that intramodular hub genes are highly correlated with the module eigengene. fuzzy measure of module membership hierarchical clustering and most other standard clustering methods such as partitioning around medoids result in a binary module assignment, i.e. a node is either in or outside of a module. in some applications it may be advantageous to define a continuous, fuzzy measure of module membership for all nodes. such measure is particularly useful to identify nodes that lie near the boundary of a module, or nodes that are intermediate between two or more modules. as explained in detail in, the module membership of node i in module q can be defined as kcor,i:=cor), where xi is the profile of node i and e is the module eigengene of module q. the module membership measure kcor,i lies in and specifies how close node i is to module q, q =..., q. the larger |kcor,i|, the more similar node i is to the eigengene of the q-th module. in some publications, kcor,i is referred to as signed module eigengene based connectivity measure kme. this is the reason why we named the corresponding r function signedkme. automatic block-wise module detection many microarray gene expression measurements report expression levels of tens of thousands of distinct genes. building and analyzing a full network among such a large number of nodes can be computationally challenging because of memory size and processor speed limitations. the wgcna package contains several improvements that address this challenge. the function blockwisemodules is designed to handle network construction and module detection in large data sets. the function first pre-clusters nodes into large clusters, referred to as blocks, using a variant of k-means clustering. next, hierarchical clustering is applied to each block and modules are defined as branches of the resulting dendrogram. to synthesize the module detection results across blocks, an automatic module merging step is performed that merges modules whose eigengenes are highly correlated. the time and memory savings of the block-wise approach are substantial: a standard, single-block network analysis of n nodes requires o memory and o calculations, while the block-wise approach with block size nb requires only o memory and o calculations, making an analysis of say genes in blocks of feasible on a standard computer. consensus module detection when dealing with multiple adjacency matrices representing different networks, it can be interesting to find consensus modules, defined as modules that are present in all or most networks. intuitively, two nodes should be connected in a consensus network only if all of the input networks agree on that connection. this naturally suggest to define the consensus network similarity between two nodes as the minimum of the input network similarities. in certain cases it may be useful to replace minimum by a suitable quantile since the resulting measure may be more robust. consensus module detection can be performed step-by-step for maximum control and exibility, or in one step using the function blockwiseconsensusmodule that calculates consensus modules across given data sets in a block-wise manner analogous to the block-wise module detection in a single data set. category 3: functions for module and gene selection finding biologically or clinically significant modules and genes is a major goal of many co-expression analyses. the definition of biological or clinical significance depends on the research question under consideration. abstractly speaking, we define a gene significance measure as a function gs that assigns a non-negative number to each gene; the higher gsi the more biologically significant is gene i. in functional enrichment analysis, a gene significance measure could indicate pathway membership. in gene knock-out experiments, gene significance could indicate knock-out essentiality. a microarray sample trait t can be used to define a trait-based gene significance measure as the absolute correlation between the trait and the expression profiles, equation a measure of module significance can be defined as average gene significance across the module genes. when dealing with a sample trait t, a measure of statistical significance between the module eigengene e and the trait t can be defined, for example, using correlation or a p-value obtained from a univariate regression model between e and t. modules with high trait significance may represent pathways associated with the sample trait. genes with high module membership in modules related to traits are natural candidates for further validation. category 4: functions for studying topological properties many topological properties of networks can be succinctly described using network concepts, also known as network statistics or indices. network concepts include whole network connectivity, intramodular connectivity, topological overlap, the clustering coefficient, density etc. differential analysis of network concepts such as intramodular connectivity may reveal regulatory changes in gene expressions. the wgcna package implements several functions, such as softconnectivity, intramodularconnectivity, tomsimilarity, clustercoef, networkconcepts, for computing these network concepts. basic r functions can be used to create summary statistics of these concepts and for testing their differences across networks. network concepts for measuring cluster structure gene clustering trees and tom plots that visualize interconnectivity patterns often suggest the presence of large modules. network theory offers a wealth of intuitive network concepts for describing the pairwise relationships among genes that are depicted in cluster trees and heat maps. to illustrate this point, we describe two network concepts in the following. by visual inspection of figures 2c and 4b, genes appear to be highly interconnected, e.g. turquoise module genes form a reddish square in the tom plot. this property of dense connections among the genes of module q can be measured using the concept of module density, which is defined as the average adjacency of the module genes: density)=∑i∑j≠iaijn−1) where a denotes the n × n adjacency matrix corresponding to the sub-network formed by the genes of module q. another useful concept is the clustering coefficient of gene i, which is a measure of'cliquishness'. specifically, clustercoefi=∑l≠i∑m≠i,lailalmami{2−∑l≠i2}. in unweighted networks, clustercoefi equals if and only if all neighbors of gene i are also linked to each other. for weighted networks, ≤ aij ≤ implies that ≤ clustercoefi ≤. the mean clustering coefficient has been used to measure the extent of module structure present in a network. category 5: functions for simulating microarray data with modular structure simple yet sufficiently realistic simulated data is often important for evaluation of novel data mining methods. the wgcna package includes simulation functions simulatedatexpr, simulatemultiexpr, simulatedatexpr5modules that result in expression data sets with a customizable modular structure. the user can choose the modular structure by specifying a set of seed eigengenes, one for each module, around which each module is built. module genes are simulated to exhibit progressively lower correlations with the seed which leads to genes with progressively lower intramodular connectivity. the user can specify module sizes and the number of background genes, i.e. genes outside of the modules. the seed eigengenes can be simulated to reflect dependence relationships between the modules. category 6: visualization functions module structure and network connections in the expression data can be visualized in several different ways. for example, the co-expression module structure can be visualized by heatmap plots of gene-gene connectivity that can be produced using the function tomplot. examples are presented in figures 2c and 4b. an alternative is a multi-dimensional scaling plot; an example is presented in figure 2b. relationships among modules can be summarized by a hierarchical clustering dendrogram of their eigengenes, or by a heatmap plot of the corresponding eigengene network, illustrated in figures 3c, d, and 4c, d. the package includes several additional functions designed to aid the user in visualizing input data and results. these functions rely on basic plotting functions provided in r and the packages sma and fields. category 7: functions for interfacing with other software packages to enhance the integration of wgcna results with other network visualization packages and gene ontology analysis software, we have created several r functions and corresponding tutorials. for example, our r functions exportnetworktovisant and exportnetworktocytoscape allow the user to export networks in a format suitable for visant and cytoscape, respectively. our online r tutorials also show how to interface wgcna results with gene ontology packages available directly in r, e.g. gosim. many gene ontology based functional enrichment analysis software programs such as david, amigo, webgestalt simply take lists of gene identifiers as input. ingenuity pathway analysis allows the user to input gene expression data or gene identifiers. mouse data application as an example of the type of analysis one can perform with wgcna, we describe a network analysis of liver expression data from female mice. the data and biological findings of this analysis have been described in. briefly, mrna levels in female mouse livers were measured by microarrays with over probe sets. in addition to the expression data, multiple physiological and metabolic traits were measured. for computational reasons, the original analysis presented in was restricted to most connected genes, and for simplicity we will work with the same set of genes. while we do use the same data, the module detection methods are slightly different and the results are similar but not the same. the code used to perform this analysis is part of the tutorials posted on our webpage. the network and the identified modules are depicted in figures 4a, b. to understand the physiologic significance of the modules, we correlated the module eigengenes with physiological traits such as body weight, cholesterol level, insulin level. the full module-trait correlation table is presented in the accompanying tutorial. in the following, we will only consider mouse body weight as sample trait. the module eigengenes of the following three modules were highly correlated with body weight: brown, red, and salmon. we used the online software david to determine whether the three body weight related modules were significantly enriched with regard to known gene ontologies. the brown module is significantly enriched in categories "glycoprotein" and "signal". the red module is enriched in "cell cycle" and "chromosome". the salmon module is most significantly enriched in the category "lipid synthesis". overall, the high enrichment scores suggest that these modules are indeed biologically meaningful. to study the relationships between modules, we correlate their eigengenes. in general, relationships between modules can be studied by using correlation networks between eigengenes. in these meta-networks between modules, the adjacency between modules reflects the correlation between the module eigengenes, and modules of eigengenes are referred to as meta-modules. a sample trait such as body weight can be incorporated as an additional node of the eigengene network. the adjacency between the sample trait and an eigengene is sometimes referred to as the eigengene significance. figures 4c, d depict the eigengene network using a dendrogram and a heatmap plot. we find that eigengenes may exhibit highly significant correlations, e.g. the red and brown modules are highly correlated. groups of correlated eigengenes corresponds to meta-modules and are recognizable as branches of the eigengene dendrogram, and as reddish squares along the diagonal of the heatmap plot. figures 4c indicates that there are four meta-modules. body weight falls within the meta-module grouping together the blue, brown, red, salmon, and yellow modules. in practice, it is difficult to determine whether the modules underlying a meta-module are truly distinct or whether they should be merged. sometimes gene ontology information can provide some clues. it is interesting to find centrally located intramodular hub genes in the body weight related modules since their expression profile represents that of the entire module. to find intramodular hub genes, one can use the module membership measure k, equation figure 4e shows a scatterplot between the body weight based gene significance measure gsi, equation and module membership in the brown module. the high correlation between gene significance and module membership implies that hubgenes in the brown module also tend to be highly correlated with body weight. this suggests that both gene significance and module membership can be combined in a systems biologic screening method for finding body weight related genes. figure 4f shows a visant plot among the most connected genes in the brown module. this brief description illustrates how wgcna can lead to testable hypotheses that require validation in independent data sets. a tutorial underlying this example and figure can be found on our webpage. tutorials we provide a comprehensive set of online tutorials that guide the user through major steps of correlation network analysis. the tutorials provide r code the user can copy-and-paste into an r session, along with comments and explanations of both the input and output. the code is organized into short sections, each of which addresses a particular task. in particular, the tutorials cover the following topics: correlation network construction, step-by-step and automatic module detection, consensus module detection, eigengene network analysis, differential network analysis, interfacing with external software packages, and data simulation. the tutorials use both simulated and real gene expression data sets. discussion the wgcna package complements other network related packages for r, such as the general network structures in bioconductor, gene network enrichment analysis, functional analysis of gene co-expression networks, and others. while most of the existing packages focus only on unweighted networks, wgcna implements methods for both weighted and unweighted correlation networks. wgcna can be used as a data exploratory tool or as a gene screening method. for example, wgcna can be used to explore the module structure in a network, to measure the relationships between genes and modules, to explore the relationships among modules, and to rank-order genes or modules. wgcna can be used to generate testable hypotheses for validation in independent data sets. for example, wgcna may suggest that a module is associated with a disease outcome. since correlation networks are based on correlations between quantitative variables, one can use a correlation test p-value or a regression-based p-value for assessing the statistical significance between pairs of variables. for example, it is straightforward to attach a significance level to the fuzzy module membership measures kcor,i. the relationship between standard microarray data mining techniques and gene co-expression network analysis is discussed in. users should be aware of the limitations of the methods implemented in the wgcna package. first, wgcna assumes that the microarray data have been properly pre-processed and normalized. to normalize the expression data, several r functions have been implemented in the bioconductor packages. although all normalization methods are mathematically compatible with wgcna, we recommend to use the biologically most meaningful normalization method with respect to the application under consideration. second, similar to most other data mining methods, the results of wgcna can be biased or invalid when dealing with technical artefacts, tissue contaminations, or poor experimental design. third, although several co-expression module detection methods are implemented, the package does not provide means to determine which method is best. while the default hierarchical clustering methods have performed well in several real data applications, it would be desirable to compare these and other methods on multiple real benchmark data sets. fourth, this package is limited to undirected networks. methods for orienting edges and constructing directed networks have been presented in the literature, for example in.  the wgcna r package provides a comprehensive set of functions for performing weighted correlation network analysis. the wgcna package can also be used to describe the correlation structure between gene expression profiles, image data, genetic marker data, proteomics data, and other high-dimensional data. availability and requirements project name: wgcna r package project home page: operating system: platform independent programming language: r licence: gnu gpl 3 authors' contributions both authors jointly developed the methods and wrote the article. pl packaged the functions into an r package. both authors read and approved the final manuscript. 
weighted correlation network analysis can be used for finding clusters of highly correlated genes, for summarizing such clusters using the module eigengene or an intramodular hub gene, for relating modules to one another and to external sample traits, and for calculating module membership measures. the wgcna r software package is a comprehensive collection of r functions for performing various aspects of weighted correlation network analysis. the wgcna package provides r functions for weighted correlation network analysis, e.g. the package includes functions for network construction, module detection, gene selection, calculations of topological properties, data simulation, visualization, and interfacing with external software. for example, weighted gene co-expression network analysis is a systems biology method for describing the correlation patterns among genes across microarray samples. co-expression network analysis of gene expression data. correlation networks are increasingly being used in bioinformatics applications. correlation networks facilitate network based gene screening methods that can be used to identify candidate biomarkers or therapeutic targets. while parts of the correlation network methodology have been described in separate publications, there is a need to provide a user-friendly, comprehensive, and consistent software implementation and an accompanying tutorial. along with the r package we also present r software tutorials. the r package along with its source code and additional material are freely available at.
 correlation networks are increasingly being used in bioinformatics applications. for example, weighted gene co-expression network analysis is a systems biology method for describing the correlation patterns among genes across microarray samples. weighted correlation network analysis can be used for finding clusters of highly correlated genes, for summarizing such clusters using the module eigengene or an intramodular hub gene, for relating modules to one another and to external sample traits, and for calculating module membership measures. correlation networks facilitate network based gene screening methods that can be used to identify candidate biomarkers or therapeutic targets. these methods have been successfully applied in various biological contexts, e.g. cancer, mouse genetics, yeast genetics, and analysis of brain imaging data. while parts of the correlation network methodology have been described in separate publications, there is a need to provide a user-friendly, comprehensive, and consistent software implementation and an accompanying tutorial.  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.  the wgcna package provides r functions for weighted correlation network analysis, e.g. co-expression network analysis of gene expression data. the r package along with its source code and additional material are freely available at. 