I'm using the ComplexHeatmap package in R and split my heatmap by k-mean clustering (rows and columns). Clustering for the rows works fine. For the columns I get a a 4-column cluster (control) and an 8-column cluster (treated), which is good. However, for some heatmaps the control slide is on the right side , for some on the left. I would like to order them uniformely (control left, treated right). When I rearrange the slices with the column_split function, I get 3 clusters instead of 2. How can I fix this? Thank you in advance.
Heatmap(mat, name = "mat", border=TRUE, rect_gp =gpar(col="white", lwd=1),
column_km = 2, row_km = 2, row_km_repeats = 100, column_km_repeats = 100,
show_parent_dend_line = FALSE,
column_split = factor(c(rep("A",8),rep("B",4)), levels = c("B","A")))
Ok, I came up with an idea, which is not a direct solution.
Instead of using the default k-means partition, I assigned a partition vector to column_split.
I would still appreciate other solutions.