This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Heatmap for Differential expressed genes

Hi,

I want to generate heatmap for differential expressed genes after using limma. But I got the following error.

Group <- c("GrpA","GrpA","GrpA","GrpB","GrpB","GrpB") 
design <- model.matrix(~factor(Group)) 
colnames(design) <- c("GrpA","GrpAvsGrpB") 
design

fit <- lmFit(tmp, design)
cont.matrix <- makeContrasts(GrpAvsGrpB, levels = design) 
fit2 <- contrasts.fit(fit,cont.matrix)
fit3 <- eBayes(fit2) 
tab <- topTable(fit3, coef=1, n=Inf, adjust="fdr", sort.by="none")
idx = which(xpsu.lm$adj.P.Val < 0.05)

library(gplots)
heatmap.2(tmp[idx,],trace='none',scale='row')

Error:

Error in heatmap.2(tmp[idx, ], trace = "none", scale = "row") :

'x' must have at least 2 rows and 2 columns

Please help me out. Thank you

heatmap limma r

The error is pretty clear. Check what does the idx and tmp[idx,] looks like ?

Bro, Now I tried in other way and got the differentially expressed genes. But I have them in xls file.

I have differential expressed genes in the xls file. click the following link for the picture.

http://i.imgur.com/soZFF9t.png

And in a text file I have the sample names and all the genes with the normalized values. click the following link for the picture.

http://i.imgur.com/ul1bTmp.png

So now how can I generate a heatmap with differential expressed genes and their pvalues from xls file and with the same genes I need the sample names and normalized values from txt file. How can i do that? Could you please help me ?

1 answer

what you can do is write into a file and extract the values which you wants to make a heatmap for . The problem is it should be matrix not dataframe.

Log in to answer this question.