A heatmap is a false color image (image(t(x))) with a dendrogram added to the top and left side. Typically, reordering of the rows and columns according to some set of values (row or column means) within the restrictions imposed by the dendrogram is carried out.
This package takes the original heatmap function and reduces the argument complexity.
We will use the data sets genomDat, phen, and anno to map and generate column and row annotations.
The data set genomDat is 2x2 matrix with gene expression data (subjects, genes). The phen (phenotype) data set displays the clinical information of the subject. The anno data set consists of gene mapping information.
# Sample portion of genomDat (heatmap examples will use [1:20,1:20])
genomDat[1:4,1:6]
#> X1 X2 X3 X4 X5 X6
#> 1 -0.27 -0.33 -0.06 -0.15 0.09 -0.57
#> 2 -0.33 0.21 0.27 0.03 0.09 0.66
#> 3 -0.30 -0.66 -0.06 0.12 -0.03 -0.45
#> 4 0.21 1.89 0.42 NA 0.30 -0.48
# Sample portion of phen (heatmap examples will use [1:39])
phen[1:3,]
#> id sex age_year smoking smoking_packYear alcohol alcohol_unitYear
#> 18 X1 male 60 yes 20 yes 300
#> 30 X2 female 53 yes 35 yes 280
#> 19 X3 male 52 yes 34 yes 170
# Sample portion of anno (heatmap examples will use [1:22])
anno[1:4,]
#> Chrom kb
#> 1 1 1082
#> 3 1 3318
#> 4 1 4553
#> 6 1 6372# Heatmap with column dendrogram, column annotations
generate_heatmap(genomDat, col_info = phen, col_dend = TRUE, col_anno = TRUE)# Heatmap with column dendrogram, column annotations, column label
generate_heatmap(genomDat, col_lab = TRUE, col_info = phen,
col_anno = TRUE, col_dend = TRUE, plot_info = list(margins = c(2,2)))# Heatmap with all annotations
generate_heatmap(genomDat, col_lab = TRUE, row_lab = TRUE, col_anno = TRUE,
row_anno = TRUE, col_info = phen, row_info = anno, col_dend = TRUE,
row_dend = TRUE, plot_info = list(margins = c(5,5)))# Add a title
generate_heatmap(genomDat, col_lab = TRUE, row_lab = TRUE, col_anno = TRUE,
row_anno = TRUE, col_info = phen, row_info = anno, col_dend = TRUE,
row_dend = TRUE, h_title = "Genome Heatmap", plot_info = list(margins = c(5,5)))# Change plot and annotation colors and font size
main_plot = list("cexCol" = 1.25, "cexRow" = 1.5, "cexRowSide" = 1, "cexColSide" = 1 )
cate_color = list(age_year = list(color = c("light blue", "blue")), Chrom = list(color = c("palegreen",
"darkgreen")))
generate_heatmap(genomDat, col_lab = TRUE, row_lab = TRUE, col_anno = TRUE, row_anno = TRUE,
col_info = phen, row_info = anno, col_dend = TRUE, row_dend = TRUE,
col_anno_var = c("age_year","sex"), row_anno_var = c("Chrom"), h_title = "Genome Heatmap",
plot_info = main_plot, heatmap_color =c("light blue","purple","pink"), col_var_info = cate_color,
row_var_info = cate_color)