This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Reorganize the clusters

I would like the clusters to be organized as (c1/c2/c3/c4/c5)

set.seed(123) #set seed for consistency
 HM = Heatmap(data, show_row_names = F, show_column_names = T,
                 row_names_gp = gpar(fontsize = 2),
                 km = 5, 
                 column_names_side = "bottom", gap = unit(1, "mm"),
                 column_names_rot = 90,
                 cluster_columns = F,
                 show_heatmap_legend = T,
                 row_title = "c%s",
                 border = TRUE,
    )

HM = draw(HM)
clusters

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

Thank you!

1 answer

Boa tarde,

Tem que definir os agrupamentos fora do função Heatmap(), como faço aqui: / You have to define the clusters outside of the Heatmap() function, as I do here:

Depois/ Then (after), follow the advice here: A: Complex Heatmap: Changing order of clusters

Kevin

Log in to answer this question.