Learn R Programming

WGCNA (version 1.74)

Weighted Correlation Network Analysis

Description

Functions necessary to perform Weighted Correlation Network Analysis on high-dimensional data as originally described in Horvath and Zhang (2005) and Langfelder and Horvath (2008) . Includes functions for rudimentary data cleaning, construction of correlation networks, module identification, summarization, and relating of variables and modules to sample traits. Also includes a number of utility functions for data manipulation and visualization.

Copy Link

Version

Install

install.packages('WGCNA')

Monthly Downloads

17,915

Version

1.74

License

GPL (>= 2)

Maintainer

Peter Langfelder

Last Published

January 30th, 2026

Functions in WGCNA (1.74)

addGuideLines

Add vertical ``guide lines'' to a dendrogram plot
addTraitToMEs

Add trait information to multi-set module eigengene structure
adjacency

Calculate network adjacency
TOMsimilarity

Topological overlap matrix similarity and dissimilarity
TrueTrait

Estimate the true trait underlying a list of surrogate markers.
addGrid

Add grid lines to an existing plot.
TOMsimilarityFromExpr

Topological overlap matrix
TOMplot

Graphical representation of the Topological Overlap Matrix
accuracyMeasures

Accuracy measures for a 2x2 confusion matrix or for vectors of predicted and observed values.
addErrorBars

Add error bars to a barplot.
PWLists

Pathways with Corresponding Gene Markers - Compiled by Mike Palazzolo and Jim Wang from CHDI
GTOMdist

Generalized Topological Overlap Measure
alignExpr

Align expression data with given vector
allowWGCNAThreads

Allow and disable multi-threading for certain WGCNA calculations
bicor

Biweight Midcorrelation
adjacency.polyReg

Adjacency matrix based on polynomial regression
allocateJobs

Divide tasks among workers
bicovWeights

Weights used in biweight midcovariance
adjacency.splineReg

Calculate network adjacency based on natural cubic spline regression
bicorAndPvalue

Calculation of biweight midcorrelations and associated p-values
automaticNetworkScreeningGS

One-step automatic network gene screening with external gene significance
automaticNetworkScreening

One-step automatic network gene screening
blockwiseModules

Automatic network construction and module detection
branchEigengeneDissim

Branch dissimilarity based on eigennodes (eigengenes).
blueWhiteRed

Blue-white-red color sequence
blockSize

Attempt to calculate an appropriate block size to maximize efficiency of block-wise calcualtions.
blockwiseConsensusModules

Find consensus modules across several datasets.
branchSplit

Branch split.
blockwiseIndividualTOMs

Calculation of block-wise topological overlaps
binarizeCategoricalVariable

Turn a categorical variable into a set of binary indicators
branchSplit.dissim

Branch split based on dissimilarity.
binarizeCategoricalColumns

Turn categorical columns into sets of binary indicators
chooseOneHubInEachModule

Chooses a single hub gene in each module
branchSplitFromStabilityLabels

Branch split (dissimilarity) statistics derived from labels determined from a stability study
checkAdjMat

Check adjacency matrix
clusterCoef

Clustering coefficient calculation
chooseTopHubInEachModule

Chooses the top hub gene in each module
checkSets

Check structure and retrieve sizes of a group of datasets.
colQuantileC

Fast colunm- and row-wise quantile of a matrix.
collapseRows

Select one representative row per group
coClustering.permutationTest

Permutation test for co-clustering
coClustering

Co-clustering measure of cluster preservation between two clusterings
collapseRowsUsingKME

Selects one representative row per group based on kME
consensusMEDissimilarity

Consensus dissimilarity of module eigengenes.
collectGarbage

Iterative garbage collection.
consensusProjectiveKMeans

Consensus projective K-means (pre-)clustering of expression data
consensusOrderMEs

Put close eigenvectors next to each other in several sets.
consensusCalculation

Calculation of a (single) consenus with optional data calibration.
conformityDecomposition

Conformity and module based decomposition of a network adjacency matrix.
consensusKME

Calculate consensus kME (eigengene-based connectivities) across multiple data sets.
consensusDissTOMandTree

Consensus clustering based on topological overlap and hierarchical clustering
conformityBasedNetworkConcepts

Calculation of conformity-based network concepts.
corPvalueStudent

Student asymptotic p-value for correlation
corPvalueFisher

Fisher's asymptotic p-value for correlation
correlationPreservation

Preservation of eigengene correlations
consensusRepresentatives

Consensus selection of group representatives
consensusTreeInputs

Get all elementary inputs in a consensus tree
corPredictionSuccess

Qunatification of success of gene screening
consensusTOM

Consensus network (topological overlap).
convertNumericColumnsToNumeric

Convert character columns that represent numbers to numeric
corAndPvalue

Calculation of correlations and associated p-values
cor

Fast calculations of Pearson correlation.
coxRegressionResiduals

Deviance- and martingale residuals from a Cox regression model
displayColors

Show colors used to label modules
dynamicMergeCut

Threshold for module merging
factorizeNonNumericColumns

Turn non-numeric columns into factors
exportNetworkToVisANT

Export network data in format readable by VisANT
exportNetworkToCytoscape

Export network to Cytoscape
fixDataStructure

Put single-set data into a form useful for multiset calculations.
empiricalBayesLM

Empirical Bayes-moderated adjustment for unwanted covariates
cutreeStaticColor

Constant height tree cut using color labels
cutreeStatic

Constant-height tree cut
greenBlackRed

Green-black-red color sequence
goodSamplesGenesMS

Iterative filtering of samples and genes with too many missing entries across multiple data sets
greenWhiteRed

Green-white-red color sequence
fundamentalNetworkConcepts

Calculation of fundamental network concepts from an adjacency matrix.
goodSamplesMS

Filter samples with too many missing entries across multiple data sets
goodSamples

Filter samples with too many missing entries
goodSamplesGenes

Iterative filtering of samples and genes with too many missing entries
formatLabels

Break long character strings into multiple lines
goodGenesMS

Filter genes with too many missing entries across multiple sets
goodGenes

Filter genes with too many missing entries
hubGeneSignificance

Hubgene significance
hierarchicalConsensusTOM

Calculation of hierarchical consensus topological overlap matrix
hierarchicalConsensusModules

Hierarchical consensus network construction and module identification
Inline display of progress

Inline display of progress
hierarchicalConsensusCalculation

Hierarchical consensus calculation
hierarchicalConsensusMEDissimilarity

Hierarchical consensus calculation of module eigengene dissimilarity
imputeByModule

Impute missing data separately in each module
hierarchicalMergeCloseModules

Merge close (similar) hierarchical consensus modules
individualTOMs

Calculate individual correlation network matrices
hierarchicalConsensusKME

Calculation of measures of fuzzy module membership (KME) in hierarchical consensus modules
kMEcomparisonScatterplot

Function to plot kME values between two comparable data sets.
isMultiData

Determine whether the supplied object is a valid multiData structure
keepCommonProbes

Keep probes that are shared among given data sets
labeledBarplot

Barplot with text or color labels.
labels2colors

Convert numerical labels to colors.
labeledHeatmap.multiPage

Labeled heatmap divided into several separate plots.
list2multiData

Convert a list to a multiData structure and vice-versa.
labeledHeatmap

Produce a labeled heatmap plot
labelPoints

Label scatterplot points
intramodularConnectivity

Calculation of intramodular connectivity
matchLabels

Relabel module labels to best match the given reference labels
matrixToNetwork

Construct a network from a matrix
moduleEigengenes

Calculate module eigengenes.
minWhichMin

Fast joint calculation of row- or column-wise minima and indices of minimum elements
moduleColor.getMEprefix

Get the prefix used to label module eigengenes.
mergeCloseModules

Merge close modules in gene expression data
lowerTri2matrix

Reconstruct a symmetric matrix from a distance (lower-triangular) representation
modifiedBisquareWeights

Modified Bisquare Weights
metaZfunction

Meta-analysis Z statistic
metaAnalysis

Meta-analysis of binary and continuous variables
mtd.rbindSelf

Turn a multiData structure into a single matrix or data frame.
moduleMergeUsingKME

Merge modules and reassign genes using kME.
mtd.subset

Subset rows and columns in a multiData structure
mtd.apply

Apply a function to each set in a multiData structure.
moduleNumber

Fixed-height cut of a dendrogram.
mtd.mapply

Apply a function to elements of given multiData structures.
mtd.simplify

If possible, simplify a multiData structure to a 3-dimensional array.
mtd.setColnames

Get and set column names in a multiData structure.
mtd.setAttr

Set attributes on each component of a multiData structure
modulePreservation

Calculation of module preservation statistics
nearestCentroidPredictor

Nearest centroid predictor
nSets

Number of sets in a multi-set variable
nearestNeighborConnectivity

Connectivity to a constant number of nearest neighbors
multiSetMEs

Calculate module eigengenes.
multiUnion

Union and intersection of multiple sets
mutualInfoAdjacency

Calculate weighted adjacency matrices based on mutual information
multiGSub

Analogs of grep(l) and (g)sub for multiple patterns and relacements
multiData

Create a multiData structure.
multiData.eigengeneSignificance

Eigengene significance across multiple sets
nPresent

Number of present data entries.
newConsensusOptions

Create a list holding consensus calculation options.
newConsensusTree

Create a new consensus tree
nearestNeighborConnectivityMS

Connectivity to a constant number of nearest neighbors across multiple data sets
networkScreening

Identification of genes related to a trait
newCorrelationOptions

Creates a list of correlation options.
newNetworkOptions

Create a list of network construction arguments (options).
newBlockwiseData

Create, merge and expand BlockwiseData objects
networkScreeningGS

Network gene screening with an external gene significance measure
newBlockInformation

Create a list holding information about dividing data into blocks
networkConcepts

Calculations of network concepts
normalizeLabels

Transform numerical labels into normal order.
numbers2colors

Color representation for a numeric variable
pickHardThreshold

Analysis of scale free topology for hard-thresholding.
pickSoftThreshold

Analysis of scale free topology for soft-thresholding
overlapTableUsingKME

Determines significant overlap between modules in two networks based on kME tables.
plotClusterTreeSamples

Annotated clustering dendrogram of microarray samples
orderBranchesUsingHubGenes

Optimize dendrogram using branch swaps and reflections.
orderMEsByHierarchicalConsensus

Order module eigengenes by their hierarchical consensus similarity
overlapTable

Calculate overlap of modules
orderMEs

Put close eigenvectors next to each other
plotModuleSignificance

Barplot of module significance
plotColorUnderTree

Plot color rows in a given order, for example under a dendrogram
plotCor

Red and Green Color Image of Correlation Matrix
plotNetworkHeatmap

Network heatmap plot
plotMultiHist

Plot multiple histograms in a single plot
plotMat

Red and Green Color Image of Data Matrix
plotDendroAndColors

Dendrogram plot with color annotation of objects
plotEigengeneNetworks

Eigengene network plot
plotMEpairs

Pairwise scatterplots of eigengenes
populationMeansInAdmixture

Estimate the population-specific mean values in an admixed population.
projectiveKMeans

Projective K-means (pre-)clustering of expression data
propVarExplained

Proportion of variance explained by eigengenes.
pruneConsensusModules

Prune (hierarchical) consensus modules by removing genes with low eigengene-based intramodular connectivity
prepComma

Prepend a comma to a non-empty string
pquantile

Parallel quantile, median, mean
pruneAndMergeConsensusModules

Iterative pruning and merging of (hierarchical) consensus modules
qvalue

Estimate the q-values for a given set of p-values
proportionsInAdmixture

Estimate the proportion of pure populations in an admixed population based on marker expression values.
preservationNetworkConnectivity

Network preservation calculations
prependZeros

Pad numbers with leading zeros to specified total width
qvalue.restricted

qvalue convenience wrapper
redWhiteGreen

Red-white-green color sequence
removePrincipalComponents

Remove leading principal components from data
recutConsensusTrees

Repeat blockwise consensus module detection from pre-calculated data
rankPvalue

Estimate the p-value for ranking consistently high (or low) on multiple lists
replaceMissing

Replace missing values with a constant.
relativeCorPredictionSuccess

Compare prediction success
recutBlockwiseTrees

Repeat blockwise module detection from pre-calculated data
randIndex

Rand index of two partitions
removeGreyME

Removes the grey eigengene from a given collection of eigengenes.
sampledBlockwiseModules

Blockwise module identification in sampled data
scaleFreeFitIndex

Calculation of fitting statistics for evaluating scale free topology fit.
selectFewestConsensusMissing

Select columns with the lowest consensus number of missing data
sampledHierarchicalConsensusModules

Hierarchical consensus module identification in sampled data
shortenStrings

Shorten given character strings by truncating at a suitable separator.
sigmoidAdjacencyFunction

Sigmoid-type adacency function.
rgcolors.func

Red and Green Color Specification
scaleFreePlot

Visual check of scale-free topology
returnGeneSetsAsList

Return pre-defined gene lists in several biomedical categories.
setCorrelationPreservation

Summary correlation preservation measure
simpleConsensusCalculation

Simple calculation of a single consenus
simulateDatExpr5Modules

Simplified simulation of expression data
simulateModule

Simulate a gene co-expression module
signedKME

Signed eigengene-based connectivity
simulateMultiExpr

Simulate multi-set expression data
simulateEigengeneNetwork

Simulate eigengene network from a causal model
simpleHierarchicalConsensusCalculation

Simple hierarchical consensus calculation
simulateDatExpr

Simulation of expression data
signumAdjacencyFunction

Hard-thresholding adjacency function
signifNumeric

Round numeric columns to given significant digits.
spaste

Space-less paste
standardScreeningBinaryTrait

Standard screening for binatry traits
simulateSmallLayer

Simulate small modules
standardScreeningNumericTrait

Standard screening for numeric traits
sizeGrWindow

Opens a graphics window with specified dimensions
stdErr

Standard error of the mean of a given vector.
softConnectivity

Calculates connectivity of a weighted network.
standardScreeningCensoredTime

Standard Screening with regard to a Censored Time Variable
sizeRestrictedClusterMerge

Cluter merging with size restrictions
standardColors

Colors this library uses for labeling modules.
subsetTOM

Topological overlap for a subset of a whole set of genes
unsignedAdjacency

Calculation of unsigned adjacency
stratifiedBarplot

Bar plots of data across two splitting parameters
swapTwoBranches

Select, swap, or reflect branches in a dendrogram.
verboseBoxplot

Boxplot annotated by a Kruskal-Wallis p-value
verboseBarplot

Barplot with error bars, annotated by Kruskal-Wallis or ANOVA p-value
userListEnrichment

Measure enrichment between inputted and user-defined lists
transposeBigData

Transpose a big matrix or data frame
vectorTOM

Topological overlap for a subset of the whole set of genes
vectorizeMatrix

Turn a matrix into a vector of non-redundant components
verboseIplot

Scatterplot with density
votingLinearPredictor

Voting linear predictor
verboseScatterplot

Scatterplot annotated by regression line and p-value
GOenrichmentAnalysis

Calculation of GO enrichment
SCsLists

Stem Cell-Related Genes with Corresponding Gene Markers
BrainLists

Brain-Related Categories with Corresponding Gene Markers
AFcorMI

Prediction of Weighted Mutual Information Adjacency Matrix by Correlation
BD.getData

Various basic operations on BlockwiseData objects.
BrainRegionMarkers

Gene Markers for Regions of the Human Brain
ImmunePathwayLists

Immune Pathways with Corresponding Gene Markers
BloodLists

Blood Cell Types with Corresponding Gene Markers