HeatMap - Module-trait relationship
1
0
Entering edit mode
4.0 years ago

Hi,

I have working with the following code from Peter Langfelder’s tutorial, it’s about module-trait association in WGCNA but I have a doubt about the heatmap. When we run the following code from Peter Lagnfelder’s tutorial, we can put Matrix = moduleTraitPvalue instead Matrix = moduleTraitCor?

This is the tutorial's code:

nGenes = ncol(datExpr)
nSamples = nrow(datExpr)
MEs0 = moduleEigengenes(datExpr, moduleColors)$eigengenes
MEs = orderMEs(MEs0)
moduleTraitCor = cor(MEs, datTraits, use = "p")
moduleTraitPvalue = corPvalueStudent(moduleTraitCor, nSamples)
textMatrix = paste(signif(moduleTraitCor, 2), "\n(",
signif(moduleTraitPvalue, 1), ")", sep = "")
dim(textMatrix) = dim(moduleTraitCor)
par(mar = c(6, 8.5, 3, 3))
labeledHeatmap(Matrix = moduleTraitCor,
xLabels = names(datTraits),
yLabels = names(MEs),
ySymbols = names(MEs),
colorLabels = FALSE,
colors = greenWhiteRed(50),
textMatrix = textMatrix,
setStdMargins = FALSE,
cex.text = 0.5,
zlim = c(-1,1),
main = paste("Module-trait relationships"))

If I put Matrix=moduleTraitPvalue can I interpretate my results as correct? Can I work with the moduleTraitPvalue?

Thanks,

Silvia

wgcna heatmap module-trait association • 2.5k views
ADD COMMENT
1
Entering edit mode
4.0 years ago

Hi Silvia,

If you use moduleTraitPvalue instead of moduleTraitCor, all module that do not significantly correlate with your traits, i.e. p-value ~ 1.0 will be highlighted in red, while all the significant correlations p-value < 0.05, will be highlighted in white. This is not intuitive.

If you want to show only the P-value of the correlation but still use a color gradient for the correlation values, you could set the argument textMatrix as follow:

labeledHeatmap(Matrix = moduleTraitCor,
                xLabels = names(datTraits),
                yLabels = names(MEs),
                ySymbols = names(MEs),
                colorLabels = FALSE,
                colors = blueWhiteRed(50),
                textMatrix = signif(moduleTraitPvalue, 1),
                setStdMargins = FALSE,
                cex.text = 0.6,
                zlim = c(-1,1),
                main = paste("Module-trait relationships"))
ADD COMMENT
0
Entering edit mode

Ok, thank you Andres! But one thing, if my clinical traits are only the clinical outcome, I mean, the results of the applied treatment: positive, negative or unchanged in the patients, is it correct write in the file’s data trait 1 for the positive, -1 for the negative and 0 for the unchanged? Because I want to know which modules are implied in the positive results.

Thanks!

ADD REPLY
0
Entering edit mode

You could treat the clinical traits: positive, negative and unchanged as binary traits. You can assign 1 to the positive and 0 to negative and unchanged (Positive vs All). However, you should do the same for the negative and unchanged because a module could significantly correlates with more than one trait.

ADD REPLY
0
Entering edit mode

Ok, I don’t know how to work with binary trait so I do positive (1) vs All (negative and unchanged 0) but you suggest me to do the same with negative and unchanged, what are you meaning when you say do the same?

Thanks for your patience

ADD REPLY
0
Entering edit mode

This is just an example but the datTraits should look like this:

Positive    Negative    Unchanged
Sample-1    1   0   0
Sample-2    1   0   0
Sample-3    1   0   0
Sample-4    0   1   0
Sample-5    0   1   0
Sample-6    0   1   0
Sample-7    0   0   1
Sample-8    0   0   1
Sample-9    0   0   1
ADD REPLY
0
Entering edit mode

Wow, it’s a very good idea thank you so much! The heatmap I have obtained it’s the following:

Module-Trait-Relationships

So the conclusion that I can interpret is the modules correlated with the positive clinical outcome are the brown and black, is it correct?

ADD REPLY
0
Entering edit mode

Hi Silvia,

First, that Samples trait should not be there. You did some mistake when you prepared the datTraits object. Second, unfortunatelly none of your modules significantly correlates with your traits: the p-values are very high (number in parentheses) and the degree of correlation is very low.

It is difficult to say what went wrong. This might be how your samples behave or you did not perform a proper data pre-processing steps.

For example: i) how many samples do you have? ii) how many differentially expressed genes did you find? iii) how did you normalized the expression data? iv) did your run a PCA to see if your samples cluster accroding to your experimental variables: Positive, Negative and Unchagend

ADD REPLY
0
Entering edit mode

Oh, yes sorry I have forgotten to remove the Samples. Well, I have 20 samples which corresponds to 10 patients, every patient have the control sample and the treatment sample. I obtained 246 DEG and I have normalized it using the RMA method. Yes, I have did a PCA and the sample aggregation was poor because of the heterogenity of the samples. The tow conditions (control and treatment) don't differentiate very well between them.

Well, my two conditions are control and treatment the results of the treatment are the positive, negative and unchanged are results of the experiment.

ADD REPLY

Login before adding your answer.

Traffic: 1806 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