Problem for getting P-Value in Module-Trait Relationship in WGCNA
1
3
Entering edit mode
6.3 years ago
modarzi ▴ 170

Hi,

I Use WGCNA for network analysis. So, one of the WGCNA steps is designing plot of Module-Trait Relationship. In this plot, we can see the relationship between different extracted modules and different Trait variables. Also, in this plot we can see P-Value for each Module-Trait Relationship.So, via these P-Values we can find significant relationships between modules and Traits. In my study, the number of modules is high and in the plot, the number of P-values for each relationship is mixed and not readable. I need help for extracting these p-value as a .csv file out of this plot. I appreciate if any body help me for my problem.

Best Regards,

Mohammad

WGCNA P-Value Network Analysis • 4.9k views
ADD COMMENT
0
Entering edit mode

What have you tried? - please edit the post to show code, and describe your problem in detail.

ADD REPLY
0
Entering edit mode

Hi,

Thanks for your comment. I need to attached my module-trait relationship plot for showing problem. could you please guide me how can I upload my .pdf file via this post?

Description My Problem: I have to work on 53 cancer samples from one of the TCGA Cancer dataset. I used WGCNA for constructing network and finding significant modules. my data dimension is 53 samples and 56000 gene type. after running WGCNA, I see 99 modules. Now, I don't know 99 module is ok or my analysis has problem? secondly, I plot Modules-Trait relationship. in tutorial of WGCNA, you can see p-value for each relationship but in my plot because of lots of modules, numbers of p-value mix together and I cant see it(I can zoom on it). so, I am looking for function for getting P-value based on each module-trait relationship.

I appericiate if you share your comment with me

Best Regards,

Mohammad

ADD REPLY
0
Entering edit mode

Please paste the code that you have used to generate the module-trait relationships.

ADD REPLY
0
Entering edit mode

Dear Dr. Blighe

Hi,

Thanks for your comments.my code is in below:

###########Relating modules to physiological traits##############
# Choose a module assignment
moduleColorsSTLMS=moduleColorsAutomatic
# Define numbers of genes and samples
nGenes = ncol(datExprSTLMS)
nSamples = nrow(datExprSTLMS)
# Recalculate MEs with color labels
MEs0 = moduleEigengenes(datExprSTLMS,moduleColorsSTLMS)$eigengenes
MEsSTLMS = orderMEs(MEs0)
modTraitCor = cor(MEsSTLMS, datTraitsSTLMS, use = "p")
modTraitP = corPvalueStudent(modTraitCor, nSamples)
# We color code each association by the correlation value :Will display correlations and their p-values
textMatrix = paste(signif(modTraitCor, 2), "\n(",
                   signif(modTraitP, 1), ")", sep = "")
dim(textMatrix) = dim(modTraitCor)
par(mar = c(6, 8.5, 3, 3))
par(mar = c(10, 5, 3, 3))
# Display the correlation values within a heatmap plot
labeledHeatmap(Matrix = modTraitCor, xLabels = names(datTraitsSTLMS),
               yLabels = names(MEsSTLMS), ySymbols = names(MEsSTLMS),
               colorLabels =FALSE,colors=greenWhiteRed(50),textMatrix=textMatrix,
               setStdMargins = FALSE, cex.text = 0.5, zlim = c(-1,1),
               main = paste("Module-trait relationships"))

So, as I the number of modules is 99, in this heatmap I can't see p-values for each relationship.

ADD REPLY
6
Entering edit mode
6.3 years ago

I see. The correlation values are stored in modTraitCor; the P values relating to these are stored in modTraitP. You can change the size of the text with cex.text. You can also modify the dimensions of your plot by saving it as a PDF and modifying width and height:

pdf("heatmap.pdf", width=11, height=11)
  labeledHeatmap(..., cex.text = 1.0, ...)
dev.off()

--------------------------------------------------

I have a more flexible function for this: CorLevelPlot - Visualise correlation results, e.g., clinical parameter correlations

[more updated version on GitHub: https://github.com/kevinblighe/CorLevelPlot]

f

h

ADD COMMENT
0
Entering edit mode

will use this enhanced version

ADD REPLY
1
Entering edit mode

Cool. Good to see you again, krushnach80

ADD REPLY
0
Entering edit mode

what about the -0.39* is that signifies strong negative correlation? and how the Species correlation is calculated as its turned into a factor .im bit curious ?

ADD REPLY
2
Entering edit mode

-0.39* signifies that the p-value is between 0.01 and 0.05. The number of asterisks indicate the level of significance. The cut-offs can be set with the parameters:

signifSymbols = c("***", "**", "*", ""),
signifCutpoints = c(0, 0.001, 0.01, 0.05, 1),

Factors will be converted into numbers based on the ordering of the factors. This may or may not make intuitive sense, depending on the type of factor.

ADD REPLY
0
Entering edit mode

okay thank you...& I used this library

ADD REPLY
0
Entering edit mode

Dear Dr. blighe

Hello and Thanks for your comments. I designed Module-Trait Relationship in WGCNA based on modTraitCor and calculated moduleTraitPvalue based on corPvalueStudent function. based on that function, A vector of p-values is generated that show the level of significance of module trait relationship. now, I have 64 modules and 21 trait features but I don't know the cut-off for p-value. in other words, I don't know p-value cut-off for significance is 0.01 or 0.05 ! I appreciate if you share your comment with me.

ADD REPLY
1
Entering edit mode

Dear modarzi, I mean no disrespect here, but you should not expect people on Biostars providing you a day-to-day support to your problems. Eventually, you as the analyst have to stand up for the results, and that is why you should decide about cutoffs and things. If you want it more conservative, use 0.01, more relaxed 0.05 (probably does not matter too much anyway), try both and see what looks more reasonable, but in any case, make decisions based on what you have learned rather than asking for spoon-feeding.

ADD REPLY
0
Entering edit mode

Dear ATpoint

Hello,

Thanks for your comment. You are right but in this case I have 64 modules and in some modules I have about 2000 genes. So, using 0.01 or 0.05 as cutoffs have huge different results. based on this differentiation, I read few papers for finding answer my question but up to now I couldn't find nay response. For this reason, I posted my question in Biostar portal. Finally, I do apologize for inconvenience you.

Best Regards,
Mohammad

ADD REPLY
0
Entering edit mode

Dear Kevin, thanks for your valuable comment, but my problem with module-trait relation is still not fixed I have sub categorical groups based on stage I-IV in the module relation heat map, but how can i list all modules related with for instance stage I based on GS vs MM? i don't want to try every module to find significant MM vs GS modules.

my another question is that how can i extract all gene names in a highly correlated module form MM vs GS?

thank you

ADD REPLY

Login before adding your answer.

Traffic: 1908 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6