Question: Problem for getting P-Value in Module-Trait Relationship in WGCNA
2
gravatar for modarzi
8 months ago by
modarzi70
modarzi70 wrote:

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

ADD COMMENTlink modified 8 months ago • written 8 months ago by modarzi70

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

ADD REPLYlink written 8 months ago by andrew.j.skelton735.6k

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 REPLYlink modified 8 months ago • written 8 months ago by modarzi70

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

ADD REPLYlink written 8 months ago by Kevin Blighe41k

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 REPLYlink written 8 months ago by modarzi70
3
gravatar for Kevin Blighe
8 months ago by
Kevin Blighe41k
Guy's Hospital, London
Kevin Blighe41k wrote:

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 COMMENTlink modified 8 months ago • written 8 months ago by Kevin Blighe41k

will use this enhanced version

ADD REPLYlink written 8 months ago by krushnach80480
1

Cool. Good to see you again, krushnach80

ADD REPLYlink written 8 months ago by Kevin Blighe41k

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 REPLYlink modified 5 months ago • written 5 months ago by krushnach80480
2

-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 REPLYlink modified 4 months ago • written 5 months ago by Kevin Blighe41k

okay thank you...& I used this library

ADD REPLYlink written 5 months ago by krushnach80480

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 REPLYlink written 4 months ago by modarzi70
1

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 REPLYlink written 4 months ago by ATpoint15k

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 REPLYlink modified 4 months ago by RamRS21k • written 4 months ago by modarzi70
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1661 users visited in the last hour