Skip to content

[Bug]: MAE with matrix assay cannot be snapshoted and restored (from UI or from file) #625

Open
@averissimo

Description

@averissimo

What happened?

The state of slices_global does not store the experiment name in the teal app, so

How to reproduce?

  • Run app below
  • Add filter in mae -> Mutations
  • Create snapshot
  • Option 1
    • Reset all filters
    • Apply snapshot
  • Option 2
    • Save snapshot to file
    • Reset all filters
    • Upload snapshot file

Notice that the mutations filter is missing

App

Click here to see teal app definition
pkgload::load_all("/home/averissimo/work/roche🟦/packages📦/teal.slice")
pkgload::load_all("/home/averissimo/work/roche🟦/packages📦/teal")

options(
  teal.log_level = "TRACE",
  teal.log_layout = paste(
    "{crayon::bold(logger::colorize_by_log_level(level, levelr))}",
    "from {namespace}",
    "[{crayon::italic(format(time, \"%Y-%m-%d %H:%M:%S\"))}]",
    "{logger::grayscale_by_log_level(msg, levelr)}"
  ),
  teal.show_js_log = TRUE,
  # teal.bs_theme = bslib::bs_theme(version = 5),
  shiny.bookmarkStore = "server"
)

app <- init(
  data = teal_data() |> within({
    env_temp <- new.env()
    data("miniACC", package = "MultiAssayExperiment", envir = env_temp)
    mae <- env_temp$miniACC
    rm(env_temp)
  }),
  filter = teal_slices(
    # teal_slice("mae", "TCGA-OR-A5J3-01A-11D-A29I-10", selected = character(0), experiment = "Mutations", arg = "subset")
  ),
  modules = modules(
    example_module("example")
  )
)

shiny::runApp(app)

Origin of bug

The FilterStatesMatrix class inherits the srv_add method that generates a teal_slice that doesn't store the experiment / arg attributes.

Snapshot file inspected

Notice the missing experiment and arg attributes

{
  "slices": [
    {
      "dataname"       : "mae",
      "varname"        : "TCGA-OR-A5J5-01A-11D-A29I-10",
      "id"             : "mae TCGA-OR-A5J5-01A-11D-A29I-10",
      "choices"        : ["0", "1"],
      "selected"       : ["0", "1"],
      "fixed"          : false,
      "anchored"       : false,
      "multiple"       : true
    }
  ],
  "..."
}

sessionInfo()

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions