ComplexHeatmap icon indicating copy to clipboard operation
ComplexHeatmap copied to clipboard

row_split reorders row_order even with cluster_row_slices = FALSE

Open ojziff opened this issue 2 years ago • 6 comments

Hi @jokergoo

I am unable to control the heatmap ordering when using row_split and row_order even when specifying cluster_row_slices = FALSE. The row order is correct when I don't specify row_split.

 Heatmap(mat,
          row_order = topVar$gene_name,
          show_row_names = FALSE, 
          row_split =  factor(topVar$database, levels = c(1,2)),
          right_annotation = rowAnnotation(markers = anno_block(gp = gpar(fill = c("white", "white")), labels = c("1 markers", "2 markers"), labels_gp = gpar(fontsize = 8))), row_title = NULL,
          column_order = marker.column_order$sample,
          column_split = factor(marker.column_order$fraction, levels = c("cyto", "nuc", "who")),
          bottom_annotation = HeatmapAnnotation(markers = anno_block(gp = gpar(fill = c("white", "white", "white")), labels = c("Cyto samples", "Nuc samples", "Who samples"), labels_gp = gpar(fontsize = 8))), column_title = NULL,
          column_names_gp = gpar(fontsize = 6),
          cluster_row_slices = FALSE, cluster_column_slices = FALSE, cluster_columns = FALSE,cluster_rows = FALSE,
          border = TRUE, heatmap_legend_param = list(title = "", direction = "vertical"))

I have exactly the same issue with column_split

Please could you advise how I can set the row/column order whilst using row/column split.

I am using ComplexHeatmap_2.13.1

Many thanks! Oliver

ojziff avatar Aug 01 '22 16:08 ojziff

The row ordering should be kept in each row slice.

Can you send me the data, i.e., mat and topVar?

jokergoo avatar Aug 03 '22 10:08 jokergoo

row_split =  factor(topVar$database, levels = c(1,2))
cluster_rows = FALSE
cluster_row_slices = FALSE

The order of the slices will be defined by the order of topVar$database. Within each slice, the row ordering should be kept.

blueskypie avatar Aug 27 '22 17:08 blueskypie

Thanks @blueskypie but those arguments are already set and the row ordering is lost with row_split = factor(topVar$database, levels = c(1,2))

ojziff avatar Aug 27 '22 19:08 ojziff

by the row ordering is lost, do you mean the order of the slice is different from the order of topVar$database? or do you mean that, within each slice, the order of the rows are different from your expectation?

blueskypie avatar Aug 28 '22 00:08 blueskypie

@ojziff I think it would be great if you can also attach the plot and explain your issue.

jokergoo avatar Sep 01 '22 07:09 jokergoo