when I run WGCNA, i face such problem, can somebody help me!
net <- blockwiseModules(
expr_filtered,
power = 16,
TOMType = "unsigned",
minModuleSize = 30,
mergeCutHeight = 0.25,
numericLabels = TRUE,
saveTOMs = TRUE,
saveTOMFileBase = "huyou_TOM_block",
verbose = 3
)
Warning message:
In blockwiseModules(expr_filtered, power = 22, TOMType = "unsigned", :
blockwiseModules: mergeCloseModules failed with the following error message:
Error in mergeCloseModules(datExpr, colors[gsg$goodGenes], cutHeight = mergeCutHeight, :
Error in moduleEigengenes(expr = exprData[[set]]$data, colors = setColors, :
Color levels are empty. Possible reason: the only color is grey and grey module is excluded from the calculation.
--> returning unmerged colors.
1 answer
There are too few valid genes in the input matrix expr_filtered, possibly because after the goodSamplesGenes filtering, only the grey module (default label for unclassified genes) remains. The data may contain a large number of missing values or low-expression genes, making it difficult to form effective modules.
The user-defined power = 16 might be too high, resulting in low connectivity between genes. This creates an overly sparse network, preventing the formation of effective modules. It is generally recommended to use topological analysis (e.g., pickSoftThreshold) to select the minimum power value that brings R² close to 0.9 (commonly 6–12 in examples).
If all genes are assigned to the grey module (default unclassified), and excludeGreyModule = TRUE (default setting), an error may occur due to the absence of color levels.
1. Check Data Preprocessing
# Ensure gene and sample filtering is complete
gsg <- goodSamplesGenes(expr_filtered, verbose = 3)
if (!gsg$allOK) {
expr_filtered <- expr_filtered[gsg$goodSamples, gsg$goodGenes]
}
# Check for missing values again
sum(is.na(expr_filtered)) # Should be 0
2. Re-select the Soft Threshold (Power)
powers <- c(1:20)
sft <- pickSoftThreshold(expr_filtered, powerVector = powers, verbose = 5)
# Choose the minimum power value where R² approaches 0.9 (usually between 6 and 12)
plot(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
xlab="Power", ylab="Scale Free Topology Model Fit")
abline(h=0.9, col="red")
Log in to answer this question.
what your gene expression matrix size or dimension?