Please help with "pheatmap" in R
1
2
Entering edit mode
7.7 years ago
seta ★ 1.9k

Hi all,

I am trying to show differentially expressed genes based on their log fold change on the heatmap using pheatmap, however, no desired picture yet. There are 3 samples under a treatment that compared with control, the minimum and maximum log fold change are -8.5 and +9.3, respectively, so I used threshold (Thr) of 8 to determine the color key range. Also, there are some missing value in data that specified with the sign of "-", in fact, the gene X is DE just in sample 3, so it missed in the samples 1 and 2. Could you please let me know how the pheatmap handle such values?

I used the below commands for creating heatmap:

data <- read.delim("heat.txt", header=T)
rnames <- data[,1]
mat <- data.matrix(data[,2:ncol(data)])
rownames(mat) <- rnames
Thr <- 8
mat[mat < -thr] <- -thr
mat[mat > thr] <- thr
pheatmap(mat, breaks=seq(from=-thr, to=thr), cluster_col=FALSE, cluster_row=FALSE, cellwidth=15, cellheight=5)

I have modified commands several times, but this dirty picture was regenerated.

enter image description here

As you could see: 1) The height of the heatmap is not adjusted and I don't know how to set it to have the whole picture with high resolution, could you please help me in this setting?

2) There is just blue color instead of the color spectrum. Actually, I want to show even small differences between samples (say one unit) using the color key. Please kindly help me what should I do?

As it's my first experience, your help is really required. I would appreciate it in advance.

pheatmap log fold change • 7.2k views
ADD COMMENT
1
Entering edit mode
ADD REPLY
0
Entering edit mode

Not the question you ask but the answer you deserve: have a look at ggplot2 for your plotting. Among more guidelines you can find on the internet there is for example: https://learnr.wordpress.com/2010/01/26/ggplot2-quick-heatmap-plotting/

ADD REPLY
0
Entering edit mode

Thank you for your comment, I'll try it. At the moment, however, I prefer to use pheatmap.

ADD REPLY
0
Entering edit mode
7.5 years ago
TriS ★ 4.7k

for visualizatio purposes don't use log FC, use the original data. even more importantly, scale and center them and then plot them. make sure to inlcude your max/min of the scaled data in the scale or pheatmap won't draw them. alternatively, you can scale them directly in the pheatmap function.

also for visualization plot 3 normal vs 3 treated instead of just the 3 treated, that gives a much better idea of the variability across samples and the changes vs. your control.

check out in the pheatmap manual how to change text size (hint: fontsize_row/cols)

ADD COMMENT

Login before adding your answer.

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