0

I am trying to run this code for wgcna to relate modules * traits:

weight <- as.data.frame(datTraits[, "weight", drop = FALSE])
names(weight) = "weight"
modNames = substring(names(MEs), 3)
geneModuleMembership = as.data.frame(cor(datExpr, MEs, use = "p"));
MMPvalue = as.data.frame(corPvalueStudent(as.matrix(geneModuleMembership), nSamples));
names(geneModuleMembership) = paste("MM", modNames, sep="");
names(MMPvalue) = paste("p.MM", modNames, sep="");
geneTraitSignificance = as.data.frame(cor(datExpr, weight, use = "p"));
GSPvalue = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance), nSamples));
names(geneTraitSignificance) = paste("GS.", names(weight), sep="");
names(GSPvalue) = paste("p.GS.", names(weight), sep=""); 
##Plotting the graph
module = "plum1"
column = match(module, modNames);
moduleGenes = moduleColors==module;
pdf("plum1.pdf", width = 7, height = 7);
par(mfrow = c(1,1));
verboseScatterplot(abs(geneModuleMembership[moduleGenes, column]),
                   abs(geneTraitSignificance[moduleGenes, 1]),
                   xlab = paste("Module Membership in", module, "module"),
                   ylab = "Gene significance",
                   main = paste("Module membership vs. gene significance\n"),
                   cex.main = 1.2, cex.lab = 1.2, cex.axis = 1.2, col = module) 

It runs without any error but does not give the scatter plot output. Thank you!

  • 1
    [See here](https://stackoverflow.com/q/5963269/5325862) on making a reproducible example that is easier for folks to help with. We don't have your data and don't know what packages you're using, so we can't run your code. You didn't include any output, so it's unclear what your code does. There's also just a lot of code packed in here that seems either redundant or not totally necessary for the question—again, that's just a guess without being able to run anything – camille Aug 20 '21 at 19:50
  • @camile, I am using WGCNA package in R. I am using this code to relate modules by traits. It works and produces all the output except for the scatter plot. – user1567654 Aug 20 '21 at 19:56

0 Answers0