Skip to content

[BUG] heatmap annotation column order is not respected by iSEE::iSEE() #568

Open

Description

@lcolladotor

Describe the bug

Hi, using iSEE version 2.4.0 I can't seem to be able to set the heatmap annotation columns in the order I want them to be displayed.

If I go to https://libd.shinyapps.io/tran2021_NAc/, I see that donor is listed before cell_type.

Screen Shot 2021-07-28 at 4 58 53 PM

If I switch the order around, I get the plot I want to show where samples are ordered by cell_type first, donor second.

Screen Shot 2021-07-28 at 4 58 39 PM

However, if I change the order in the code LieberInstitute/10xPilot_snRNAseq-human@c4a019a then I still get donor listed before cell_type in the shiny app.

To Reproduce

App code is at https://github.com/LieberInstitute/10xPilot_snRNAseq-human/tree/c4a019a02142725ef7766cecce76983d6dfa6bcf/shiny_apps/tran2021_NAc. The two rds files needed are not there but I can send them to you if needed. sce_nac_small.rds is 263 MB and cell_colorss_nac.rds is 389 B. https://libd.shinyapps.io/tran2021_NAc/ was built with iSEE version 2.4.0 from Bioconductor 3.13.

Expected behavior

For the code to reproduce the second screenshot.

Screenshots
If applicable, add screenshots to illustrate your problem.

Desktop (please complete the following information):

  • OS: iOS Big Sur 11.4
  • Browser: Chrome
  • Version: Version 92.0.4515.107 (Official Build) (x86_64)

Additional context

I don't think that bca7288 nor #549 are related.

Session info (please complete the following information)

Local info https://github.com/LieberInstitute/10xPilot_snRNAseq-human/blob/c4a019a02142725ef7766cecce76983d6dfa6bcf/shiny_apps/06_clean_NAc_2021.R#L82-L218 used for deploying the app.

Activity

  1. csoneson commented on Jul 30, 2021

    @csoneson
    Member

    I think this stems from the way shiny initializes the selectize inputs. I could reproduce it with the following minimal example:

    sce <- scRNAseq::ReprocessedAllenData(assays="tophat_counts")
    sce <- scater::logNormCounts(sce, exprs_values="tophat_counts")
    iSEE::iSEE(sce, initial = list(ComplexHeatmapPlot(ColumnData = c("driver_1_s", "Core.Type")),
                                   ComplexHeatmapPlot(ColumnData = c("Core.Type", "driver_1_s"))))
    

    (the two heatmaps look the same). The initialization of the column data to display in the heatmaps is done here:

    iSEE/R/interface_visual.R

    Lines 374 to 380 in 7b20d42

    .selectizeInput.iSEE(x, .heatMapColData,
    label = "Column annotations:",
    selected = slot(x, .heatMapColData),
    choices = all_coldata,
    multiple=TRUE,
    options=list(plugins=list('remove_button', 'drag_drop')),
    help = TRUE),

    However, shiny will place the selected values in the same order as they appear among the available choices. I tried with a tiny app, defining a selectizeInput as

    selectizeInput(inputId = "sel",
                   label = "Select multiple",
                   selected = c("A", "B"),
                   choices = c("B", "C", "A"),
                   multiple = TRUE)
    

    and the selected values would be shown as B A (in the order provided in choices). Now, I'm not sure what is the best way to get around this (I guess we'd have to reorder all_coldata according to slot(x, .heatMapColData)) - the quickest solution for you might be to reorder the columns in colData(sce)...

  2. added a commit that references this issue on Aug 1, 2021
  3. lcolladotor commented on Aug 1, 2021

    @lcolladotor
    ContributorAuthor

    Thanks Charlotte!

    Re-ordering the colData() fixed things for us. LieberInstitute/10xPilot_snRNAseq-human@a4eda2c

    Best,
    Leo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions