Annoate complex heatmap columns
1
0
Entering edit mode
7 months ago
synat.keam ▴ 100

Dear Fellows,

I have reviewed the complex heatmap tutorial,but could not replicate it with my data.

https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html

Point is I am trying to annotate the heatmap from columns 1:5 (Group 1), 6:10 (Group 2), 11:15 (Group 3) up to group 5.

my first attempt to generate heatmap worked:

#complex heatmap
## Heatmap_1
library(ComplexHeatmap)
Heatmap(heatmap, name = "cytokine", rect_gp = gpar(col = "white", lwd =3),
        column_title = "Cytokine panel", 
        column_names_gp = grid::gpar(fontsize= 10),
        row_names_gp = grid::gpar(fontsize= 6),
        cluster_rows = FALSE,
        cluster_columns = FALSE)

However, once I attempted to annotate every 5 five column, I got weird output and columns number is no longer in order. I tried to adjust the parameters, but could not get what I wanted.

## Heatmap_2
Heatmap(heatmap, name = "cytokine", rect_gp = gpar(col = "white", lwd =3),
        column_title = "Cytokine panel", 
        column_names_gp = grid::gpar(fontsize= 10),
        row_names_gp = grid::gpar(fontsize= 6),
        cluster_rows = FALSE,
        cluster_columns = FALSE,
        top_annotation = HeatmapAnnotation(foo= anno_block(gp= gpar(fill= 1:25), 
        labels = c("group1", "group2", "group3", "group4", "group5"),
        labels_gp = gpar(col= "white", fontsize= 10))), column_km =5)

I would just simply need to annotate every five columns and like them to be in order: Tumor-1, Tumor-2 etc. If anyone could have a look and help, that would be great.

Thanks!

heatmap_1_not annotate

heatmap_2_annotate_wrong ouput

complexheatmap • 773 views
ADD COMMENT
0
Entering edit mode
ADD REPLY
4
Entering edit mode
7 months ago
bk11 ★ 2.5k

Please do not use column_km = 5 for your second Heatmap instead use split function because you have turned cluster_rows = FALSE, cluster_columns = FALSE for the first Heatmap. You should be able to generate your Heatmap using code below-

split = rep(1:5, each = 5)
ha = HeatmapAnnotation(
  empty = anno_empty(border = FALSE),
  foo = anno_block(gp = gpar(fill = 2:6), labels = c("group1","group2","group3","group4","group5"))
  )

Heatmap(heatmap, name = "cytokine", rect_gp = gpar(col = "white", lwd =3),
        column_title = "Cytokine panel", 
        column_names_gp = grid::gpar(fontsize= 10),
        row_names_gp = grid::gpar(fontsize= 6),
        cluster_rows = FALSE,
        cluster_columns = FALSE, column_split = split, top_annotation = ha)
ADD COMMENT

Login before adding your answer.

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