Question: I get the same modules but different number of genes WGCNA
gravatar for debitboro
22 months ago by
debitboro110 wrote:

Hi Biostars,

I've a question about WGCNA for co-expression network analysis. When I try to merge the modules basis on their expression profile using the following code:

merge = mergeCloseModules(datExpr, dynamicColors, cutHeight = 0.2, verbose = 3)

I get the merged module with the number of genes inside each module using the code to display those modules:


I get the same modules like above, BUT with different number of genes in each module, when I calculate the gene-module membership using:

geneModuleMembership =, MEs, use = "p"));
listModule <- c() #new list of modules
for (i in 1: numberGenes){
listModule <- c(listModule, names(which.max(abs(geneModuleMembership[i,]))))

Do you have an idea why I get different number of genes ?

Thanks in advance

ADD COMMENTlink written 22 months ago by debitboro110

Different by how much? Many programs produce non-deterministic output unless they allow for a way to produce deterministic output.

ADD REPLYlink written 22 months ago by genomax64k

Thank you genomax2 for you response.

I post here the results for the two sets:


    black          blue         brown          cyan     darkgreen
      345          1509           679           580           236
 darkgrey    darkorange       darkred darkturquoise         green
      103            92           294           418           656
greenyellow          grey   lightyellow          pink        purple
          689           161          2330           691           294
    royalblue        salmon
          143           228



    MEblack          MEblue         MEbrown          MEcyan     MEdarkgreen
        546             909             775             562             307
 MEdarkgrey    MEdarkorange       MEdarkred MEdarkturquoise         MEgreen
        381             318             446             435             764
MEgreenyellow          MEgrey   MElightyellow          MEpink        MEpurple
            668             335            1389             550             333
    MEroyalblue        MEsalmon
            338             392
ADD REPLYlink modified 22 months ago • written 22 months ago by debitboro110
gravatar for MMa
22 months ago by
MMa250 wrote:

The problem is why you used geneModuleMembership =, MEs, use = "p")) in the first place. WGCNA doesn't use Pearson correlation to assign genes to modules, so for all facts and purposes you're doing a different method of clustering. Certainly mergeCloseModules uses correlation, but that involves the correlation between module eigengenes. Because of this, there's no guarantee that any individual gene's correlation with its own ME is the smallest.

ADD COMMENTlink modified 22 months ago • written 22 months ago by MMa250

Thank you MMa,

Yeah, I think I'll use the gene-module membership measure calculated from mergeCloseModules() instead to use the Pearson's correlation

ADD REPLYlink written 22 months ago by debitboro110

If this answer helped you please up-vote/accept (green check mark) to provide closure for the thread.

ADD REPLYlink written 22 months ago by genomax64k
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: 1075 users visited in the last hour