Entering edit mode
7.5 years ago
joseph.houjue
•
0
Dear all,
I have the code as this:
Define numbers of genes and samples
nGenes = ncol(VAX_Expr)
nSamples = nrow(VAX_Expr)
Recalculate MEs (1st principal component) with color labels
MEs0 = moduleEigengenes(VAX_Expr, moduleColors)$eigengenes
ME is the correlation matrix of module and sample, by row is sample, by column is module
MEs = orderMEs(MEs0)
make correlation btween module and trait
moduleTraitCor = cor(MEs, VAX_Bench, use = "p")
moduleTraitPvalue = corPvalueStudent(moduleTraitCor, nSamples)
The correlation value btw trait and module can be found in the moduleTraitCor, however, when I plot GS vs MM, the cor and corp is not the same in the moduleTraitCor and moduleTraitPvalue.
Caculate the module membership (GS for each module)
geneModuleMembership = as.data.frame(cor(VAX_Expr, MEs, use = "p"))
MMPvalue = as.data.frame(corPvalueStudent(as.matrix(geneModuleMembership), nSamples))
names (colors) of the modules
modNames = substring(names(MEs), 3)
names(geneModuleMembership) = paste("MM", modNames, sep="")
names(MMPvalue) = paste("p.MM", modNames, sep="")
module = "brown"
column = match(module, modNames)
moduleGenes = moduleColors == module
verboseScatterplot(abs(geneModuleMembership[moduleGenes,column]),
abs(df_geneTraitGS[moduleGenes,1]),
xlab = paste("Module Membership in", module, "module"),
ylab = c("Gene significance"),
main = paste("Module membership vs. Gene significance\n"),
cex.main = 1.2, cex.lab = 1.2, cex.axis = 1.2,
pch = 21, col = "black", bg = module)
I don't understand the question, what is not the same, could you post the numeric differences between them (and where do you calculate each?)
There is a new related question, here: Module membership vs gene significance does not correlate (WGCNA)