WGCNA "trait" file format?
1
0
Entering edit mode
2.4 years ago
Hyper_Odin ▴ 250

I am trying to create co-expression network between lncRNA and RNA but I am not sure if the "trait" file I have made is correct. I have 14 samples with two conditions "Nodules" and "ctrl". Is this format right?

Client  group
X3  1
X4  1
X5  1
X6  1
X8  1
X9  1
X10 1
X11 1
X15 1
X16 1
X17 1
X128    0
X129    0
X130    0

RNA-Seq sequencing R gene • 1.5k views
0
Entering edit mode

Did you try using this file and it didn't work, that's why you are asking it? Or you didn't try it? Looks ok to me.

0
Entering edit mode

It worked. but I was not sure if the results are correct. I am getting an error while generating the heatmap, so I was not confident.

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"))


Error in colorMatrix[, c] : incorrect number of dimensions

0
Entering edit mode

Somethings seems to be wrong in your colormatrix. Try making the heatmap with default colors. Use blueWhiteRed instead of greenWhiteRed.

0
Entering edit mode

Still the same error :(

0
Entering edit mode

seems like its a common problem. I found the same problem in a Chinese website Which I translated to English. https://www.omicsclass.com/question/2568

0
Entering edit mode

Yes over there also you see it is related to color scale. Could also be related to difference in row names of phenodata and sample ids.

4
Entering edit mode
24 months ago
Prakash ★ 2.2k

ploting heatmap using complexheatmap alternative to labeledHeatmap

# Define numbers of genes and samples
nGenes = ncol(datExpr);
nSamples = nrow(datExpr);
# Recalculate MEs with color labels
MEs0 = moduleEigengenes(datExpr, dynamicColors)$eigengenes MEs = orderMEs(MEs0) moduleTraitCor = cor(MEs, datTraits$group, use = "p");
moduleTraitPvalue = corPvalueStudent(moduleTraitCor, nSamples);

sizeGrWindow(10,6)
# Will display correlations and their p-values
textMatrix = paste(signif(moduleTraitCor, 2), "(",signif(moduleTraitPvalue, 1), ")", sep = "");
dim(textMatrix) = dim(moduleTraitCor)
# Display the correlation values within a heatmap plot
Heatmap(moduleTraitCor,
name = "Cor",
column_title="Module-trait relationships",
rect_gp = gpar(col = "black"),
cell_fun = function(j, i, x, y, width, height, fill) {
grid.text(sprintf(textMatrix[i, j]), x, y, gp = gpar(fontsize = 10))})