Heat Map Using R- Based On Percentage
1
2
Entering edit mode
12.3 years ago
jackuser1979 ▴ 890
 id         sno1  sno2  sno3  sno4
gene1     23.42 23.4   88.8   98.21
gene2      0     0     99.7   95.5
gene3     77.4  100    44.4   65.6
gene4      0     0     0      0
gene5     100   100   100    100
 :
 :
gene 1000 58.3  33.8   78.8  56.6

I have rows 1000 X 4 columns. The four columns given (sno1,sno2,sno3 & sno4) given in percentage. I want to compare how many of individual gene show in invidiual columns. I want to create heatmap for easy interpretation. I am new to R, any one can help, how to create heatmap for this data.

r heatmap • 10k views
ADD COMMENT
1
Entering edit mode

you might find the answer I gave here helpful. It uses ggplot2 + R and the code I have written includes facetting for multiple plots, but it is fairly easy to arrive at what you need with a bit of trial & error.

ADD REPLY
3
Entering edit mode
12.3 years ago
seidel 11k

Probably the easiest way is to simply use the heatmap function in R. Assuming your data is in a matrix called "sno_data", you could do the following:

heatmap(sno_data, Colv=NA, Rowv=NA)

This will generate a heatmap image of your data, however the genes will be numbered sequentially from the bottom up (i.e. gene 1 will be at the bottom of the image). The Colv and Rowv arguments turn clustering off. Perhaps you want to see if there is any similarities among your genes, you can turn clustering for the rows on by leaving out that argument:

# draw heatmap with title, and let the rows be clustered
heatmap(sno_data, Colv=NA, main="my nice heatmap")

Other things to consider are the coloring, by default the heatmap function scales the data for coloring (see ?heatmap for an explanation). So another view of the data is to see it unscaled:

# turn off color scaling
heatmap(sno_data, Colv=NA, main="my nice heatmap", scale="none")

Make sure your data is a matrix (not a dataframe), you might have to use:

heatmap(as.matrix(sno_data))
ADD COMMENT
1
Entering edit mode

Thanks for help. I have created heat map by following these steps: sno <- read.csv(file.choose())

sno_matrix <- data.matrix(sno)

heatmap(snomatrix, Colv=NA, Rowv=NA) heatmap(snomatrix, Colv=NA, main="heatmap")

heatmap(sno_matrix, Colv=NA, main="heatmap", scale="none")

But in my heat map, column id was included. But I need to remove column id from the heat map. How can I remove that?

ADD REPLY
2
Entering edit mode

You mean the gene ids are being included in a column of your matrix, and you'd like to plot only the numbers? There are two ways to achieve this. One is to tell R which column to use for ids when you import the data, for instance, if your gene names are in the first column of your csv file, then set the row.names argument to that column: read.csv(file.choose(), row.names=1). That way, R will use the first column of your data to name the rows, rather than putting those values into the imported matrix. The second way would be, if your first column is already gene ids, to just ignore it, and reference the columns you would like to plot in your heat map: heatmap(as.matrix(sno_matrix[,2:5])). That way you hand the heatmap function only columns 2-5 of your matrix (assuming the first column is gene ids).

ADD REPLY
0
Entering edit mode

hello,

suppose that i have already downloaded GSE63706 and normalized that and i have a normalized text file now. and i have also a list of probsets (a text file of my interest probsets) in this array...i want to have a heat map showing the expression pattern of my interest probsets in this array, for example in this array i have 4 varieties and different tissues (rind and flesh) and phases (0,10,20,30,40 and 50 days after harvesting). heat maps showing the expression pattern of my probsets in varieties, tissues and phases i mean

please

ADD REPLY

Login before adding your answer.

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