insightsengineering / insightsengineering/teal.slice

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

Open
#625 0 comments 0 reactions 0 assignees View on GitHub
bug core
Dominant language
R
Stars
12
Forks
7
Avg merge
3d 31m
Merged PRs (30d)
1

Description

### 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

```r
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

```json
{
"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

- [X] I agree to follow this project's Code of Conduct.

### Contribution Guidelines

- [X] I agree to follow this project's Contribution Guidelines.

### Security Policy

- [X] I agree to follow this project's Security Policy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.