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),
  metadata = NULL
)

Arguments

dataset

(MulitiAssayExperiment)
single MultiAssayExperiment for which filters are rendered

dataname

(character)
A given name for the dataset it may not contain spaces

keys

optional, (character)
Vector with primary keys

label

(character)
Label to describe the dataset

metadata

(named list or NULL)
Field containing metadata about the dataset. Each element of the list should be atomic and length one.


Method get_call()

Get filter expression

This functions returns filter calls equivalent to selected items within each of filter_states. Configuration of the calls is constant and depends on filter_states type and order which are set during initialization. This class contains multiple FilterStates:

  • colData(dataset)for this object single MAEFilterStates which returns subsetByColData call

  • experimentsfor each experiment single SEFilterStates and FilterStates_matrix, both returns subset call

Usage

MAEFilteredDataset$get_call()

Returns

filter call or list of filter calls


Method get_varlabels()

Gets labels of variables in the data

Variables are the column names of the data. Either, all labels must have been provided for all variables in set_data or NULL.

Usage

MAEFilteredDataset$get_varlabels(variables = NULL)

Arguments

variables

(character vector) variables to get labels for; if NULL, for all variables in data

Returns

(character or NULL) variable labels, NULL if column_labels attribute does not exist for the data


Method get_filter_overview_info()

Get filter overview rows of a dataset

Usage

MAEFilteredDataset$get_filter_overview_info(
  filtered_dataset = self$get_dataset()
)

Arguments

filtered_dataset

(MultiAssayExperiment) object to calculate filter overview statistics on.

Returns

(matrix) matrix of observations and subjects


Method get_filterable_varnames()

Gets variable names for the filtering.

Usage

MAEFilteredDataset$get_filterable_varnames()

Returns

(character(0))


Method set_filter_state()

Set filter state

Usage

MAEFilteredDataset$set_filter_state(state, ...)

Arguments

state

(named list)
names of the list should correspond to the names of the initialized FilterStates kept in private$filter_states. For this object they are "subjects" and names of the experiments. Values of initial state should be relevant to the referred column.

...

ignored.

Returns

NULL

Examples

utils::data(miniACC, package = "MultiAssayExperiment")
dataset <- teal.slice:::MAEFilteredDataset$new(miniACC, "MAE")
fs <- list(
  subjects = list(
    years_to_birth = list(selected = c(30, 50), keep_na = TRUE, keep_inf = FALSE),
    vital_status = list(selected = "1", keep_na = FALSE),
    gender = list(selected = "female", keep_na = TRUE)
  ),
  RPPAArray = list(
    subset = list(ARRAY_TYPE = list(selected = "", keep_na = TRUE))
  )
)
dataset$set_filter_state(state = fs)
shiny::isolate(dataset$get_filter_state())


Method remove_filter_state()

Remove one or more FilterState of a MAEFilteredDataset

Usage

MAEFilteredDataset$remove_filter_state(element_id)

Arguments

element_id

(list)
Named list of variables to remove their FilterState.

Returns

NULL


Method ui_add_filter_state()

UI module to add filter variable for this dataset

UI module to add filter variable for this dataset

Usage

MAEFilteredDataset$ui_add_filter_state(id)

Arguments

id

(character(1))
identifier of the element - preferably containing dataset name

Returns

function - shiny UI module


Method srv_add_filter_state()

Server module to add filter variable for this dataset

Server module to add filter variable for this dataset. For this class srv_add_filter_state calls multiple modules of the same name from FilterStates as MAEFilteredDataset contains one FilterStates object for colData and one for each experiment.

Usage

MAEFilteredDataset$srv_add_filter_state(id, ...)

Arguments

id

(character(1))
an ID string that corresponds with the ID used to call the module's UI function.

...

ignored.

Returns

moduleServer function which returns NULL


Method get_filter_overview_nsubjs()

Gets filter overview subjects number

Usage

MAEFilteredDataset$get_filter_overview_nsubjs(
  filtered_dataset = self$get_dataset(),
  subject_keys
)

Arguments

filtered_dataset

(MultiAssayExperiment) object to calculate filter overview statistics on.

subject_keys

(unused) in MultiAssayExperiment unique subjects are the rows of colData slot.

Returns

list with the number of subjects of filtered/non-filtered datasets.


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


## ------------------------------------------------
## Method `MAEFilteredDataset$set_filter_state`
## ------------------------------------------------

utils::data(miniACC, package = "MultiAssayExperiment")
dataset <- teal.slice:::MAEFilteredDataset$new(miniACC, "MAE")
fs <- list(
  subjects = list(
    years_to_birth = list(selected = c(30, 50), keep_na = TRUE, keep_inf = FALSE),
    vital_status = list(selected = "1", keep_na = FALSE),
    gender = list(selected = "female", keep_na = TRUE)
  ),
  RPPAArray = list(
    subset = list(ARRAY_TYPE = list(selected = "", keep_na = TRUE))
  )
)
dataset$set_filter_state(state = fs)
#> NULL
shiny::isolate(dataset$get_filter_state())
#> $subjects
#> $subjects$years_to_birth
#> $subjects$years_to_birth$selected
#> [1] 30 50
#> 
#> $subjects$years_to_birth$keep_na
#> [1] TRUE
#> 
#> $subjects$years_to_birth$keep_inf
#> [1] FALSE
#> 
#> 
#> $subjects$vital_status
#> $subjects$vital_status$selected
#> [1] "1"
#> 
#> $subjects$vital_status$keep_na
#> [1] FALSE
#> 
#> 
#> $subjects$gender
#> $subjects$gender$selected
#> [1] "female"
#> 
#> $subjects$gender$keep_na
#> [1] TRUE
#> 
#> 
#> 
#> $RPPAArray
#> $RPPAArray$subset
#> $RPPAArray$subset$ARRAY_TYPE
#> $RPPAArray$subset$ARRAY_TYPE$selected
#> [1] ""
#> 
#> $RPPAArray$subset$ARRAY_TYPE$keep_na
#> [1] TRUE
#> 
#> 
#> 
#>