WGCNA module colors not displaying correctly
1
1
Entering edit mode
minyaaa9058 ▴ 40
@minyaaa9058-22760
Last seen 4.8 years ago

Hi!

I'm following the WGCNA tutorials for my own dataset and things were going smoothly and detected 25 modules for my RNA-seq dataset. But when I tried to plot the cluster Dendrogram, there are only two colors, rather than 26 (25 plus cluster 0) showed up. Please help me to make the plot display correctly! The codes are as following:

> net = blockwiseModules(fm75, power = 5,
+                        TOMType = "unsigned", minModuleSize = 30,
+                        reassignThreshold = 0, mergeCutHeight = 0.25,
+                        numericLabels = TRUE, pamRespectsDendro = FALSE,
+                        saveTOMs = TRUE,
+                        saveTOMFileBase = "fm75TOM", 
+                        verbose = 3)

 Calculating module eigengenes block-wise from all genes
   Flagging genes and samples with too many missing values...
    ..step 1
 ....pre-clustering genes to determine blocks..
...
     mergeCloseModules: Merging modules whose distance is less than 0.25
       Calculating new MEs...

> table(net$colors)

   0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18 
 640 5853 2530 2190 1612 1097  768  570  359  308  298  280  277  237  203  176  136  123  112 
  19   20   21   22   23   24   25 
 111  102   77   74   64   57   49 

> sizeGrWindow(12, 9)
NULL

> # Convert labels to colors for plotting

> mergedColors = labels2colors(net$colors)

> # Plot the dendrogram and the module colors underneath
> plotDendroAndColors(net$dendrograms[[1]], mergedColors[net$blockGenes[[1]]],
+                     "Module colors",
+                     dendroLabels = FALSE, hang = 0.03,
+                     addGuide = TRUE, guideHang = 0.05)

# the plot is in the following link:
https://drive.google.com/file/d/107raMtSw7Q4TGU0Erir01fP5BtPdnS_X/view?usp=sharing


# however mergedColors seemed to show the colors of modules correctly:
> mergedColors
   [1] "blue"          "turquoise"     "grey"          "orange"        "green"        
   [6] "turquoise"     "turquoise"     "brown"         "red"           "blue"         
 ...
 [ reached getOption("max.print") -- omitted 17303 entries ]
> 

Thanks!!

WGCNA • 3.3k views
ADD COMMENT
1
Entering edit mode
@peter-langfelder-4469
Last seen 7 weeks ago
United States

The most likely scenario is that your data was split into several blocks and you only see the dendrogram for the first block. Please read the paragraphs(s) in the tutorial that start with "A word of caution" and "A second word of caution". If you have enough RAM, try running the entire WGCNA analysis in one block, it makes some of the subsequent steps easier to execute.

ADD COMMENT
0
Entering edit mode

Thanks for the reply! And it is indeed the problem of being broken up into several blocks, and increase the maxBlockSize made the new dendrogram displaying colors correctly -- sorry I should have noticed that!

However, this new run with increased maxBlockSize changed the number of TOM of the result: it changed from 25 (as in the first post to 10):

> net = blockwiseModules(fm75, power = 5,
+                        TOMType = "unsigned", minModuleSize = 30,
+                        reassignThreshold = 0, mergeCutHeight = 0.25,
+                        numericLabels = TRUE, pamRespectsDendro = FALSE,
+                        saveTOMs = TRUE, maxBlockSize = 20000,
+                        saveTOMFileBase = "fm75TOM", 
+                        verbose = 3)

 Calculating module eigengenes block-wise from all genes
   Flagging genes and samples with too many missing values...
    ..step 1
 ..Working on block 1 .
    TOM calculation: adjacency..
    ..will use 8 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
   ..saving TOM for block 1 into file fm75TOM-block.1.RData
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 556 genes from module 1 because their KME is too low.
     ..removing 418 genes from module 2 because their KME is too low.
     ..removing 209 genes from module 3 because their KME is too low.
     ..removing 47 genes from module 4 because their KME is too low.
     ..removing 71 genes from module 5 because their KME is too low.
     ..removing 13 genes from module 6 because their KME is too low.
     ..removing 27 genes from module 7 because their KME is too low.
     ..removing 1 genes from module 8 because their KME is too low.
     ..removing 5 genes from module 10 because their KME is too low.
     ..removing 1 genes from module 11 because their KME is too low.
     ..removing 2 genes from module 14 because their KME is too low.
 ..merging modules that are too close..
     mergeCloseModules: Merging modules whose distance is less than 0.25
       Calculating new MEs...

> table(net$colors)
   0    1    2    3    4    5    6    7    8    9   10 
1350 7485 4284 2088 1701  518  395  240  110   88   44 

Is this also due to the fact that my first run was broken into four blocks and thus similar modules were not merged between different blocks?

Thanks!

ADD REPLY
1
Entering edit mode

My guess is that you are correct. If you want more modules, increase deepSplit to 2 or 2.5; the default is 1 and is perhaps a bit too conservative.

ADD REPLY

Login before adding your answer.

Traffic: 959 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6