This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Sorted hetamap using R

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

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

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

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

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.

0 answers

No answers yet.

Log in to answer this question.