You simply have to put your custom colors in a List, and hand it to the pheatmap()
function. It's explained pretty clearly in the help for pheatmap (type: ?pheatmap at your R prompt). There's an example below. 36 colors will be impossible to distinguish. You can see that starting with just a few from your table, some of the types can't be distinguished.
### Draw a heat map with Custom Color Annotations
library(pheatmap)
# create some data
dat <- matrix(rnorm(180), nrow=10, ncol=18)
# label rows
rownames(dat) <- paste0("g", 1:10)
# label columns
colnames(dat) <- paste0("e", 1:18)
# make up a table of cancer classifications, for the columns
cancer_types <- data.frame(CancerType=c(rep("CLL", 3), rep("BLCA", 3), rep("LUAD", 3),
rep("PRAD", 3), rep("STAD", 3), rep("GBM", 3)))
rownames(cancer_types) <- colnames(dat)
# Specify custom colors for our cancer types
ann_colors = list(
CancerType=c(CLL="#FF0000", BLCA="#FF2A00", LUAD="#FF5500",
PRAD="#FF8000", STAD="#FFAA00", GBM="#FFD500")
)
# draw the heatmap with column annotations, and custom annotation colors
pheatmap(dat, annotation_col=cancer_types, annotation_colors=ann_colors,
main="toy heat map")