matrixCtrlServer: Shiny module server functions to generate filter UI for...

View source: R/matrixCtrl.R

matrixCtrlServerR Documentation

Shiny module server functions to generate filter UI for interactive matrix

Description

Update matrix data and metadata for the appropriate plotting module.

Usage

matrixCtrlServer(
  id,
  M = NULL,
  N = NULL,
  P = NULL,
  cutoffP = 0.05,
  cdata = NULL,
  metadata = NULL,
  vkey = NULL,
  newdata = reactive({ }),
  mfilter = NULL
)

Arguments

id

Character ID for specifying namespace, see shiny::NS.

M

A data matrix, e.g. a correlation matrix, which must have row and column names.

N

A matrix of the same dimensions as 'M' to be used as a filter layer, e.g. sample size.

P

A matrix of the same dimensions as 'M' to be used as a filter layer, e.g. p-values.

cutoffP

A cutoff value for 'P' to be used as default for filtering.

cdata

The data used for generating the matrix, necessary for allowing user-uploaded data for mutable 'M'.

metadata

Optional, a 'data.table' with different types of metadata/annotation to be used as filters. If not given, the only filter option will be the row names in M. Column names will be the names of the filter group.

vkey

The column in metadata that maps to row/col names in M, i.e. the key column such as VarID. If metadata is not given, should be something like "Name" because the only selection possible is by row names.

newdata

Optional, reactive data such as a user upload passed in by the dataUploadServer module or from some other component, and which is suitable for merging with

cdata

to calculate a new 'M'.

mfilter

Optional reactive object for storing filter values that need to be communicated to other modules.

Details

What is available as filters relies on the underlying metadata. The metadata should be a table that can be passed into the parameter

metadata

, with a key column referencing the matrix index and additional columns for each type of metadata attribute. The base UI implements interactive filters as drop-down selections. The server function returns the data with user-applied filters, i.e. the main input to be visualized with matrixMainServer.

Value

Reactive values in mstate object that keeps track of visible matrices and selected metadata and is used by the associated plotting module.

To-do

The UI can also expand/integrate with an optional "add-on" widget to provide an alternate, perhaps more intuitive interface for filtering. For example, compared to a drop-down selection of geographical locations, a map widget would provide a better selection interface. Not all types of metadata can be integrated with a widget, and the module provides capability for only one widget. The server function needs to return when the widget should be called (displayed).


avucoh/DIVE documentation built on Aug. 29, 2023, 6:02 p.m.