Calculation of module membership in WGCNA
1
1
Entering edit mode
ag1805x ▴ 50
@ag1805x-15215
Last seen 5 days ago

What is the difference between the following two chunks of code?

geneModuleMembership = as.data.frame(cor(datExpr, MEs, use = "p"));
MMPvalue = as.data.frame(corPvalueStudent(as.matrix(geneModuleMembership), nSamples));
geneTraitSignificance = as.data.frame(cor(datExpr, weight, use = "p"));
GSPvalue = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance), nSamples));


and

datKME = signedKME(datExpr, MEs, outputColumnName = "kME")


The first chunk is to calculate Gene Significance GS (the absolute value of the correlation between the gene and the trait) and module membership MM (the correlation of the module eigengene and the gene expression profile). While in the second, the signedKME is used for calculation of (signed) eigengene-based connectivity, also known as module membership.

Is there any difference between them in calculation of module membership? Which one should be used and in what scenario? For hub gene selection, which is better - kME, GS or MM?

WGCNA RNA-seq ModuleMembership Network Hub gene • 1.7k views
1
Entering edit mode
@peter-langfelder-4469
Last seen 4 months ago
United States

signedKME does a lot of checks but it essentially also simply calculates the correlation (not the p-values). You need to use kME or MM (should be the same) for hub gene selection. GS measures association with trait, not module membership or hubgene status.

0
Entering edit mode

I have a question regarding the Gene Significance since I am very confused with my results.

In the module-trait correlation heatmap, the cyan module looks not significant - it has p-value > 0.2 for each trait. I am using this chunk of code for the matrix:

moduleTraitCor = cor(MEs, datTraits, use = "p");
moduleTraitPvalue = corPvalueStudent(moduleTraitCor, nSamples);

textMatrix =  paste(signif(moduleTraitCor, 2), "\n(",
signif(moduleTraitPvalue, 1), ")", sep = "");
dim(textMatrix) = dim(moduleTraitCor)
textMatrix

par(mar = c(8, 13, 3, 3));
# Display the correlation values within a heatmap plot
heatmap <- labeledHeatmap(Matrix = moduleTraitCor,
xLabels = names(datTraits),
yLabels = names(MEs),
ySymbols = names(MEs),
yLabelsPosition = "left",
colorLabels = FALSE,
colors = blueWhiteRed(50),
textMatrix = textMatrix,
setStdMargins = FALSE,
cex.text = 0.7,
zlim = c(-1,1),
main = paste("Module-trait relationships"))


However when I plot the barplots for GeneSignificance (using the chunk of code below), I get completely different results. In case of the mentioned Cyan module it suddenly becomes the most significant one for the trait DG (in the matrix above DG had correlation p-value = 0.4)

GS1=as.numeric(cor(DG,datExpr, use="p"))
GeneSignificance=GS1
length(GeneSignificance)
length(moduleColors)
ModuleSignificance=tapply(GeneSignificance, moduleColors, mean, na.rm=T)
ModuleSignificance

sizeGrWindow(10,8)
par(mfrow = c(1,1))
par(mar=c(6,4,4,4))
plotModuleSignificance(GeneSignificance,
ylab = "Gene significance for DG",
ylim=c(-0.5,0.5),
moduleColors,
las = 2,
main = "Gene significance across modules")


What is the reason for this? I am not sure which of these I should use to pick up the significant/relevant modules? My understanding is that the Module-Trait relationship matrix is meant to show which modules are interesting (significantly correlate with the traits). I expected the barplots to confirm the same information, am I wrongly interpreting the Gene Significance?

From the heatmap it clearly looks like the genes in one sample are biasing the CYAN eigengene so I would exclude this module anyway. But I have troubles understanding the plots, why they show different correlations?