I have a total of 35 tumor samples classified into 4 subtypes. Subtype A, B, C, and D. I have RNAseq data. I'm interested in identifying modules related to each subtype with co-expression network analysis. I have read the WGCNA tutorial and create a trait.csv file like below:

Showing here some rows of the trait.csv file.

enter image description here

SamInfo <- read.csv("trait.csv")

Samples = rownames(datExpr);
traitRows = match(Samples, SamInfo$Samples);
datTraits = SamInfo[traitRows, -1];
rownames(datTraits) = SamInfo[traitRows, 1];

nGenes = ncol(datExpr);

nSamples = nrow(datExpr);

#calculate eigengenes (1st principal component) of modules
MEs0 = moduleEigengenes(datExpr, dynamicColors)$eigengenes
MEs = orderMEs(MEs0)
moduleTraitCor = cor(MEs, datTraits, use = "p");
moduleTraitPvalue = corPvalueStudent(moduleTraitCor, nSamples);

#Will display correlations and their p-values
textMatrix = paste(signif(moduleTraitCor, 2), "\n(", signif(moduleTraitPvalue, 1), ")", 
                   sep = "");
dim(textMatrix) = dim(moduleTraitCor)
par(mar = c(6, 8.5, 3, 3));

#Display the correlation values within a heatmap plot
labeledHeatmap(Matrix = moduleTraitCor, xLabels = names(datTraits), 
               yLabels = names(MEs), ySymbols = names(MEs), colorLabels = FALSE, 
               colors = blueWhiteRed(50), textMatrix = textMatrix, setStdMargins = FALSE, 
               cex.text = 0.5, zlim = c(-1,1), main = paste("Module-trait relationships"))

The Correlation between Subtypes and Modules Heatmap looks like below:

enter image description here

For functions identification (Pathway Analysis), from the above output for each subtype, should I select only the modules that were significantly positively correlated with subtypes, or Can I also use the significantly negatively correlated modules?

Is it good to use the modules that were not significant for pathway analysis?

In case if I can use positive and negative correlated modules, Can I combine those modules and use those genes for Pathway analysis?


If you can run pathway analysis programmatically on all modules, yes, do it on all modules. Otherwise, select the modules with strongest associations with each subtype, both positive and negative. I would keep the modules separate because they may have very different biological functions.

  • $\begingroup$ Thanks for the answer. One small question. Lets say from the above image, for Subtype A I have selected modules salmon, grey60, tan (negative), and midnightblue (positive) for pathway analysis. I see that salmon module is also significantly positive with Subtype C. So, then the pathways I get from salmon module are related to which subtype? $\endgroup$ – stack_learner Jun 9 '20 at 17:19
  • 1
    $\begingroup$ Well, I don't see the figure anymore so I can only go by your description, but if salmon module is negatively correlated with A, it means (most of) the genes in the module are downregulated in subtype A and upregulated in (positively associated with) subtype C. $\endgroup$ – Peter Langfelder Jun 10 '20 at 18:54
  • $\begingroup$ thanq. sorry for the heatmap with correlation values modules and trait information. Have some doubt whether here MEs0 = moduleEigengenes(datExpr, ?)$eigengenes I have to use dynamicColors which is before merging or moduleColors which is after merging. In the above image I used dynamicColors. 2) there are few modules like turquoise and blue with more than 8000 and 5000 genes. The number is huge. How do I reduce the number? $\endgroup$ – stack_learner Jun 12 '20 at 12:56
  • 1
    $\begingroup$ You can use either merged or un-merged colors; I would suggest using the merged ones. $\endgroup$ – Peter Langfelder Jun 13 '20 at 22:58
  • 1
    $\begingroup$ Some modules are often very large which just reflects a factor (driving expression or co-expression) that strongly affects a lot of genes. This could be biological or technical, and could be important to you or a nuisance confounder. You could try to identify the factor e.g. from sample clustering (could be a batch effect) or by relating the MEs of largest modules to known sample characteristics (age, sex, race etc). If you identify a match, adjust the data for it, or simply adjust the data for the ME and run WGCNA again. $\endgroup$ – Peter Langfelder Jun 13 '20 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.