Sorted hetamap using R
0
0
Entering edit mode
7.9 years ago
#### ▴ 220

I want to generate the sorted heatmaps based on the expression, what function I have to use to get the sorted heatmap based on expression, here is the script I wrote to generate the heatmap:

  library(gplots) a <- read.csv("heatmap_input.csv",sep=",")
  row.names(a) <- a$Gene 
  a  <- a[,2:6]
  a_matrix <- data.matrix(a)
  cR=c(0.85) 
  cols= colorpanel(20,'blue','black','yellow')
  a_heatmap <-  heatmap.2(a_matrix,col=cols,dendrogram='row',Colv=NA,key=TRUE,keysize = 
  1.0, main = 'ctrl vs treated', density.info="none",trace="none",cexRow=cR,scale="row",   margins=c(5,5))
heatmap RNA-Seq R • 3.7k views
ADD COMMENT
0
Entering edit mode

I think you need to order the data yourself before making the heatmap. Also, sorted based on expression is unclear.

ADD REPLY
0
Entering edit mode

Look at the parameters Rowv and Colv of heatmap.2().

ADD REPLY
0
Entering edit mode

Colv shall help me , but its ordering all the columns , but lets say I want sample group wise lets say unregulated on the top or down regulated at the bottom or viceversa

ADD REPLY
0
Entering edit mode

I think you can give a vector of indices to Colv so you generate the ordering you want and pass this as Colv argument. Alternatively, reorder your data matrix and use Colv = FALSE.

ADD REPLY

Login before adding your answer.

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