Question: WGCNA heatmap error
gravatar for evelyn
2 days ago by
evelyn90 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 • 117 views
ADD COMMENTlink modified 1 day ago • written 2 days ago by evelyn90

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 2 days ago by Alex Nesmelov50

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

ADD REPLYlink written 2 days ago by evelyn90

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

ADD REPLYlink written 1 day ago by mbk0asis550

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

ADD REPLYlink written 1 day ago by evelyn90

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 18 hours ago • written 21 hours ago by Alex Nesmelov50
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: 1264 users visited in the last hour