Skip to contents

MAEFilteredDataset R6 class

MAEFilteredDataset R6 class

Super class

teal.slice::FilteredDataset -> MAEFilteredDataset

Methods

Inherited methods


Method new()

Initialize MAEFilteredDataset object.

Usage

MAEFilteredDataset$new(
  dataset,
  dataname,
  keys = character(0),
  label = character(0)
)

Arguments

dataset

(MulitiAssayExperiment) single MulitiAssayExperiment for which filters are rendered.

dataname

(character(1)) syntactically valid name given to the dataset.

keys

(character) optional vector of primary key column names.

label

(character(1)) label to describe the dataset.

Returns

Object of class MAEFilteredDataset, invisibly.


Method set_filter_state()

Set filter state.

Usage

MAEFilteredDataset$set_filter_state(state)

Arguments

state

(teal_slices)

Returns

NULL, invisibly.


Method remove_filter_state()

Remove one or more FilterState of a MAEFilteredDataset.

Usage

MAEFilteredDataset$remove_filter_state(state)

Arguments

state

(teal_slices) specifying FilterState objects to remove; teal_slices may contain only dataname and varname, other elements are ignored.

Returns

NULL, invisibly.


Method ui_add()

UI module to add filter variable for this dataset.

Usage

MAEFilteredDataset$ui_add(id)

Arguments

id

(character(1)) shiny module instance id.

Returns

shiny.tag


Method get_filter_overview()

Creates row for filter overview in the form of
dataname -- observations (remaining/total) -- subjects (remaining/total) - MAE

Usage

MAEFilteredDataset$get_filter_overview()

Returns

A data.frame.


Method clone()

The objects of this class are cloneable with this method.

Usage

MAEFilteredDataset$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# use non-exported function from teal.slice
MAEFilteredDataset <- getFromNamespace("MAEFilteredDataset", "teal.slice")

data(miniACC, package = "MultiAssayExperiment")
dataset <- MAEFilteredDataset$new(miniACC, "MAE")
fs <- teal_slices(
  teal_slice(
    dataname = "MAE", varname = "years_to_birth", selected = c(30, 50), keep_na = TRUE
  ),
  teal_slice(
    dataname = "MAE", varname = "vital_status", selected = "1", keep_na = FALSE
  ),
  teal_slice(
    dataname = "MAE", varname = "gender", selected = "female", keep_na = TRUE
  ),
  teal_slice(
    dataname = "MAE", varname = "ARRAY_TYPE", selected = "", keep_na = TRUE
  )
)
dataset$set_filter_state(state = fs)
#> Warning: filters for columns: ARRAY_TYPE excluded from MAE

library(shiny)
isolate(dataset$get_filter_state())
#> {
#>   "slices": [
#>     {
#>       "dataname"       : "MAE",
#>       "varname"        : "years_to_birth",
#>       "id"             : "MAE years_to_birth",
#>       "choices"        : [14, 83],
#>       "selected"       : [30, 50],
#>       "keep_na"        : true,
#>       "fixed"          : false,
#>       "anchored"       : false,
#>       "multiple"       : true
#>     },
#>     {
#>       "dataname"       : "MAE",
#>       "varname"        : "vital_status",
#>       "id"             : "MAE vital_status",
#>       "choices"        : ["0", "1"],
#>       "selected"       : ["1"],
#>       "keep_na"        : false,
#>       "fixed"          : false,
#>       "anchored"       : false,
#>       "multiple"       : true
#>     },
#>     {
#>       "dataname"       : "MAE",
#>       "varname"        : "gender",
#>       "id"             : "MAE gender",
#>       "choices"        : ["female", "male"],
#>       "selected"       : ["female"],
#>       "keep_na"        : true,
#>       "fixed"          : false,
#>       "anchored"       : false,
#>       "multiple"       : true
#>     }
#>   ],
#>   "attributes": {
#>     "include_varnames" : {
#>       "MAE"            : ["patientID", "years_to_birth", ...
#>     },
#>     "count_type"       : "none",
#>     "allow_add"        : true
#>   }
#> }