Question: WGCNA heatmap error
gravatar for evelyn
4 months ago by
evelyn110 wrote:


I am doing network analysis for RNA-seq using WGCNA. I have created the modules and now constructing phenotype module relationship. I am getting an error in the heat map step:

 labeledHeatmap(Matrix = moduleTraitCor,
         xLabels = colnames(datTraits),
         yLabels = names(MEs),
         ySymbols = names(MEs),
         colorLabels = FALSE,
         colors = greenWhiteRed(50),
         textMatrix = textMatrix,
         setStdMargins = FALSE,
         cex.text = 0.5,
         zlim = c(-1,1),
         main = paste("Module-trait relationships"))

The error is:

Error in colorMatrix[, c] : incorrect number of dimensions.
In addition: Warning message:
In greenWhiteRed(50) :
  WGCNA::greenWhiteRed: this palette is not suitable for people
with green-red color blindness (the most common kind of color blindness).
Consider using the function blueWhiteRed instead.

Thank you for the help!

rna-seq • 701 views
ADD COMMENTlink modified 4 months ago • written 4 months ago by evelyn110

Have you check, whether the dimensions of moduleTratCor are consistent with lengths of xLabels and yLabels? dim(moduleTraitCor) == c(length(names(MEs)), length(colnames(datTraits)))

ADD REPLYlink written 4 months ago by Alex Nesmelov170

Thank you, I have got [1] TRUE TRUE after checking the dimensions.

ADD REPLYlink written 4 months ago by evelyn110

Maybe because you have more modules than colors? Try to increase the values in 'greenWhiteRed()'.

ADD REPLYlink written 4 months ago by mbk0asis570

Thank you! Yes, I had 80 modules and I increased the values in 'greenWhiteRed()'. But still got the same error.

ADD REPLYlink written 4 months ago by evelyn110

i also have such error,but its ok after i change the table of phenotype,it means you should at least have more than 1 category in trait table,if you just choose one clinical feature,it can't work.

ADD REPLYlink written 3 months ago by vincent65784078410

The colorMatrix argument was introduced in labeledHeatmap function starting from WGCNA 1.69. As an option, you may try to use an older WGCNA version. Quick and dirty way to try it is a direct loading of an old labeledHeatmap version (e.g., execution of the function code itself, for example, from Of course, it may be not compatible with the newer WGCNA version, but you'll see it from errors - if they occur, you may install the whole old version of the WGCNA package instead.

In addition, it may be helpful to switch as many as possible arguments to their default values, keeping in your example above only Matrix and xLabels, and finally, to replace even these by some bogus data with the same dimensions.

ADD REPLYlink modified 4 months ago • written 4 months ago by Alex Nesmelov170
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1261 users visited in the last hour