This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Getting Gene Name From Heatmap.2

Hello,

I am trying to get a list/table of genes from my heatmap. I am using the limma package to generate my gene list and then graphed it using gplots with the function heatmap.2 (see below). However, when I try to get the gene list, I can only get a list of the feature numbers and not the labRow names that I had directed to in the heatmap.2 function. Does anyone know how to cross reference the list of feature numbers that I got here back to the GeneName on my heatmap?

Thanks in advance, Ly

Tumor.c<-topTable(fit2,coef=4, n=500)

Tumor.c.FC<-Tumor.c$logFC

Tumor.t<-topTable(fit2,coef=5, n=500)

Tumor.T.FC<-Tumor.t$logFC

a<-cbind(Tumor.c.FC,Tumor.T.FC)

heatmap.2(a, labRow=Tumor.c$GeneName, col=greenred,Colv=FALSE)

geneName.a<-heatmap.2(a,labRow=Tumor.c$GeneName, col=greenred, Colv=FALSE)

geneName.a$rowInd

heatmap gene limma r

1 answer

In your example, to get the GeneNames back, you simply use the geneName.a$rowInd vector to to do so, eg:

R> geneName.a<-heatmap.2(a,labRow=Tumor.c$GeneName, col=greenred, Colv=FALSE)
R> Tumor.c$GeneName[geneName.a$rowInd]

The order is "backwards" though, the first gene name that comes out of that is actually the last row of the heatmap.

Log in to answer this question.