pheatmap row annotation and title font size questions
0
0
Entering edit mode
9.6 years ago
neokao • 0

I have been trying to add row annotation in my heatmap created by pheatmap in R. Basically I have a csv file with one particular column (Group) to be used for row annotation in heatmap. However, I'm having trouble with my following codes. The other two issues are: the font size of the title is apparently too big but I could not find a way to decrease it. And I wanted to set the values of any zero to color purewhite but I am not sure it is really white in my output file. The input csv file and the output pdf file are linked. I am sticking with pheatmap here since I found that it creates the heatmap that fits my need better than other heatmap functions. Suggestions are appreciated.

library("pheatmap")

data <- read.csv("/Users/neo/Test_BP_052215.csv", header = TRUE, row.names = 2, stringsAsFactors=F)
head(data)

                                                Group           WT      KO1        KO2
GO:0018904 organic ether metabolic process Metabolism  12.17372951 0.000000 -15.006995
GO:0006641 triglyceride metabolic process  Metabolism  5.200847907 0.000000   0.000000
GO:0045444 fat cell differentiation        Metabolism  6.374521098 0.000000  -7.927192
GO:0006639 acylglycerol metabolic process  Metabolism  6.028616852 0.000000   0.000000
GO:0016125 sterol metabolic process        Metabolism  5.760678325 8.262778   0.000000
GO:0016126 sterol biosynthetic process     Metabolism -6.237114754 9.622373   0.000000

heatdata <- data[,-1]
head(heatdata)

                                                     WT      KO1        KO2
GO:0018904 organic ether metabolic process  12.17372951 0.000000 -15.006995
GO:0006641 triglyceride metabolic process   5.200847907 0.000000   0.000000
GO:0045444 fat cell differentiation         6.374521098 0.000000  -7.927192
GO:0006639 acylglycerol metabolic process   6.028616852 0.000000   0.000000
GO:0016125 sterol metabolic process         5.760678325 8.262778   0.000000
GO:0016126 sterol biosynthetic process     -6.237114754 9.622373   0.000000

annotation_row <- data.frame(Group = data[,1])
rownames(annotation_row) = paste("Group", 1:38, sep = "")
ann_colors = list( Group = c(Metabolism="navy", Cellular="skyblue", Signal="steelblue", Transport="green", Cell="purple", Protein="yellow", Other="firebrick") ) 

head(annotation_row)

            Group
Group1 Metabolism
Group2 Metabolism
Group3 Metabolism
Group4 Metabolism
Group5 Metabolism
Group6 Metabolism

col_breaks = unique(c(seq(-16,-0.5,length=200), seq(-0.5,0.5,length=200), seq(0.5,20,length=200)))
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 599)

pheatmap(heatdata, main="Enrichment", color=my_palette, breaks=col_breaks, border_color = "grey20", cellwidth = 15, cellheight = 12, scale = "none",  annotation_row = annotation_row, annotation_colors = ann_colors, cluster_rows = F, cluster_cols=F, fontsize_row=10, filename="heatmap_BP_test.pdf")
heatmap pheatmap • 11k views
ADD COMMENT

Login before adding your answer.

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