Pheatmap question, how to draw a heatmap with pheatmap when you have 200 DEG to show on the heatmap?
1
0
Entering edit mode
5.8 years ago

I have 200 differentially expressed genes in my RNAseq dataset and I want to have them all on my heatmap, however, because they are a lot (200), I am not able to see them on heatmap clearly, how I can figure out the size of a heatmap which covers 200 or more genes on one heatmap, how big it should be sized?

Thanks,

rna-seq • 8.7k views
ADD COMMENT
0
Entering edit mode

May be you can use discrete colors instead of continuous colors and breaks @OP

ADD REPLY
2
Entering edit mode
5.8 years ago

You can either modify the cex parameter, or, preferably, modify the dimensions of your output figure, or use a combination of these:

Create random data of dimensions 200 x 25

data <- replicate(25, rnorm(200))
rownames(data) <- paste("Gene", c(1:nrow(data)))
colnames(data) <- paste("Sample", c(1:ncol(data)))

dim(data)
[1] 200  25

Modify cex and output dimensions

pdf("pheatmap.pdf", width=5, height=12)
  out <- pheatmap(data, 
      show_rownames=T,
      cluster_cols=T,
      cluster_rows=T,
      scale="row",
      clustering_distance_rows="euclidean",
      clustering_distance_cols="euclidean",
      clustering_method="complete",
      border_color=FALSE,
      cex=0.7)
dev.off()

top

-------------------------------------

bottom

Just be aware that, with that many genes, it will always be a struggle to get it exactly as you'd want it, e.g., for a publication.

Kevin

ADD COMMENT
0
Entering edit mode

Hi Kevin, Thanks so much for your reply. But I am a bit confused when we create a random data of dimensions,(data <- replicate(25, rnorm(200)) rownames(data) <- paste("Gene", c(1:nrow(data))) colnames(data) <- paste("Sample", c(1:ncol(data)))

dim(data)), in this code, where should I include my own data that I am supposed to make a heat map? also, is this code* separate or should be used after the above one, pdf("pheatmap.pdf", width=5, height=12) *out <- pheatmap(data, show_rownames=T, cluster_cols=T, cluster_rows=T, scale="row", clustering_distance_rows="euclidean", clustering_distance_cols="euclidean", clustering_method="complete", border_color=FALSE, cex=0.7) dev.off(),

another question, I have been trying to use your code but I dont know where my pdf is going to be saved in, and when I run this code with my own data, the only thing I get is , "pdf 5 " Thanks again, Soheila

ADD REPLY
0
Entering edit mode

To know the location where the PDF will be saved, simply run this command:

getwd()

You can change the directory with:

setwd("/home/kblighe/results/")

In the code example that I have given, your data would be used in place of my object called data.

The only parameters that I have encouraged you to use in your own code are:

  • pdf() with width and height specified
  • pheatmap() with cex specified

You do not need to worry about any of the other parameters that I have used.

Trust this helps!

ADD REPLY
1
Entering edit mode

perfect, it worked, thanks so much!

Best, Soheila

ADD REPLY
0
Entering edit mode

Good work!

ADD REPLY

Login before adding your answer.

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