Question: How to reorder the column of the heatmap following the cluster annotation?

gravatar for huynguyen96.dnu

2 hours ago by

Vietnam

Annotation:

ha = HeatmapAnnotation(IntCl = info2$groups,

                   CNAcorCl = info$groups,

                   METcorCl = info1$groups,

                   col = list(IntCl = c("1" = "turquoise", "2" = "pink"),

                              CNAcorCl = c("1" = "turquoise", "2" = "pink"),

                              METcorCl = c("1" = "turquoise", "2" = "pink")),

                   which="col")
  

and I plot the heatmap

set.seed(5342)

Heatmap(test , name = "expression levels",

    show_row_names = FALSE, 

    show_column_names = FALSE,

    cluster_rows = FALSE, 

    cluster_columns = FALSE,

    show_row_dend = FALSE,

    show_column_dend=FALSE,

    row_dend_reorder = FALSE, 

    column_dend_reorder = FALSE,

    row_title = "566 CNAcor", 

    row_title_side = "left", 

    row_title_gp = gpar(fontsize = 10),

    column_title = "208 patients", 

    column_title_side = "bottom",

    column_title_gp = gpar(fontsize = 10),

    top_annotation = ha)
  

The problem is that I want the order of the column of the heatmap to abide by the order of cluster IntCl (i.e., info2$groups). I try a lot but can not solve it.

Figure



Source link