This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Complex heatmaps: how not to cluster the slices?

Hi, below is the command with which I make heat maps with library(ComplexHeatmap). I do splitting by both columns and the rows, and it works. However, despite having 'cluster_row_slices = FALSE' and ' cluster_column_slices = FALSE', I still get both slices of columns and slices of rows reordered. Any idea what is wrong? If needed, I will try to make a reproducible example. Just am hoping that maybe there is some obvious mistake?

Heatmap(z_dheat, 
            cluster_columns=FALSE, 
            show_row_dend = FALSE, 
            border=TRUE, 
            name = "z-score", 
            show_row_names = TRUE, 
            show_column_names = FALSE,
            row_labels = dheat[rownames(dheat),2],
            split=dsplit$pathway, 
            column_split=samples$Group,
            cluster_row_slices = FALSE,
            cluster_column_slices = FALSE,
            top_annotation = colAnn,
            column_title = "Exp1", col=col_fun)
r complexheatmaps

how to delete this comment? I have reposted it to a thread below the answer as was adviced

1 answer

With that info you provided, first thing I would try was to turn row_split argument off. It is likely that the splitting is happening because your split = dsplit$pathway. And if you look at the Heatmap() function documentation, row_split=split.

That would be my first guess.

Something like:

Heatmap(z_dheat, 
            cluster_columns=FALSE, 
            show_row_dend = FALSE, 
            border=TRUE, 
            name = "z-score", 
            show_row_names = TRUE, 
            show_column_names = FALSE,
            row_labels = dheat[rownames(dheat),2],
            split=dsplit$pathway, 
            column_split=samples$Group,
            cluster_row_slices = FALSE,
            cluster_column_slices = FALSE,
            top_annotation = colAnn,
            column_title = "Exp1", col=col_fun,
            row_split = NULL)

Thank you! Does not seem to solve the problem, as it also rearranges the slices of columns when splitting by rows is not present. If no splitting, columns are arranged as in the data matrix z_dheat:

Heatmap(z_dheat, 
        cluster_columns=FALSE, 
        show_row_dend = FALSE, 
        show_row_names = TRUE, 
        show_column_names = FALSE,
        top_annotation = colAnn,
        column_title = "Exp1", col=col_fun)

If I add splitting by columns column_split=samples$Group, the order of slices changes; despite cluster_column_slices = FALSE. Anything I can do to help it?

Heatmap(z_dheat, 
            cluster_columns=FALSE, 
            show_row_dend = FALSE, 
            show_row_names = TRUE, 
            show_column_names = FALSE,
            column_split=samples$Group,
            cluster_column_slices = FALSE,
            top_annotation = colAnn,
            column_title = "Exp1", col=col_fun)

Have you tried running it with the default settings? There shouldn't be any splitting there.

Heatmap(z_heat)

I do need splitting. I just do not want to rearrange the slices, I want them in original order (but sliced). It should be achieved by the command cluster_column_slices = FALSE. However, it still does rearrange the slices

Log in to answer this question.