This is a test version of Biostars. For the public version, visit https://www.biostars.org.
gplot heatmap: row names as numbers rather than gene names

My data structure: Firts Column is Gene_ID

library(RColorBrewer)
library(heatmap.plus)
library(gplots)
EZ2_Sorted <- read_csv("EZ2 Sorted.csv")
data1<-as.matrix(EZ2_Sorted[,2:7]) # 1st column gene ID #I have total 8 columns 
heatmap.2(data1, trace = "none", density = "none", col = bluered(20),cexRow = 1, margins = c(10,12), Rowv= FALSE,Colv = FALSE)

I have tried fallowing code, but didn't help

row.names<-row.names(data1[1,])

Kindly help me Thanking you in Advance

r

1 answer

You should write instead:

row.names(data1) <- EZ2_sorted[,1]

Or even better, define row names when you read the csv file using read.csv instead of read_csv:

EZ2_Sorted <- read.csv("EZ2 Sorted.csv", row.names=1)

Vooow, that was quick and it worked perfectly. Many Thanks to you :).

Log in to answer this question.