table-generics {iSEE} | R Documentation

## Generics for table construction

### Description

Generic to control the creation of a data.frame to show in the `datatable` widget of a Table panel. Table subclasses can specialize methods to modify the behavior of `.generateOutput`.

### Constructing the table

`.generateTable(x, envir)` generates the data.frame to use in the `datatable` widget. The following arguments are required:

- `x`, an instance of a Table subclass.

- `envir`, the evaluation environment in which the data.frame is to be constructed. This can be assumed to have `se`, the SummarizedExperiment object containing the current dataset; possibly `col_selected`, if a multiple column selection is being transmitted to `x`; and possibly `row_selected`, if a multiple row selection is being transmitted to `x`.

In return, the method should add a `tab` variable in `envir` containing the relevant data.frame. This will automatically be passed to the `datatable` widget as well as being stored in `pObjects$contents`. The return value should be a character vector of commands that produces `tab` when evaluated in `envir`.

Each row of the `tab` data.frame should correspond to one row or column in the SummarizedExperiment `envir$se` for RowTables and ColumnTables respectively. Unlike `.generateDotPlotData`, it is not necessary for all rows or columns to be represented in this data.frame.

Ideally, the number and names of the columns of the data.frame should be fixed for all calls to `.generateTable`. Violating this principle may result in unpredictable interactions with existing values in the `SearchColumns` slot. Nonetheless, the app will be robust to mismatches, see `filterDT` for more details.

Any internal variables that are generated by the commands should be prefixed with `.` to avoid potential clashes with reserved variable names in the rest of the application.

This generic is called by `.generateOutput` for Table subclasses. Thus, developers of such subclasses only need to specialize `.generateTable` to change the table contents, without needing to reimplement the entirety of `.generateOutput`.

### Adding details on the selection

`.showSelectionDetails(x)` should return a HTML element containing details on the currently selected row, given an instance of a Table subclass `x`. The identity of the selected row should be extracted from `x[["Selected"]]`. The element will only be rerendered upon a single selection in the Table. Alternatively, it may return `NULL` in which case no selection details are shown in the interface.

### Author(s)

Aaron Lun

[Package iSEE version 2.6.0 Index]