Question: Sorted hetamap using R
0
gravatar for ####
2.2 years ago by
####190
####190 wrote:

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 • 954 views
ADD COMMENTlink modified 2.2 years ago • written 2.2 years ago by ####190

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

ADD REPLYlink written 2.2 years ago by Maxime Lamontagne2.1k

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

ADD REPLYlink written 2.2 years ago by Jean-Karim Heriche18k

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 REPLYlink written 2.2 years ago by ####190

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 REPLYlink written 2.2 years ago by Jean-Karim Heriche18k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1865 users visited in the last hour