iSEE: iSEE: interactive SummarizedExperiment Explorer

View source: R/iSEE-main.R

iSEER Documentation

iSEE: interactive SummarizedExperiment Explorer

Description

Interactive and reproducible visualization of data contained in a SummarizedExperiment object, using a Shiny interface.

Usage

iSEE(
  se,
  initial = NULL,
  extra = NULL,
  colormap = ExperimentColorMap(),
  landingPage = createLandingPage(),
  tour = NULL,
  appTitle = NULL,
  runLocal = TRUE,
  voice = FALSE,
  bugs = FALSE,
  saveState = NULL,
  ...
)

Arguments

se

A SummarizedExperiment object, ideally with named assays. If missing, an app is launched with a landing page generated by the landingPage argument.

initial

A list of Panel objects specifying the initial state of the app. The order of panels determines the sequence in which they are laid out in the interface. Defaults to one instance of each panel class available from iSEE.

extra

A list of additional Panel objects that might be added after the app has started. Defaults to one instance of each panel class available from iSEE.

colormap

An ExperimentColorMap object that defines custom colormaps to apply to individual assays, colData and rowData covariates.

landingPage

A function that renders a landing page when iSEE is started without any specified se. Ignored if se is supplied.

tour

A data.frame with the content of the interactive tour to be displayed after starting up the app. Ignored if se is not supplied.

appTitle

A string indicating the title to be displayed in the app. If not provided, the app displays the version info of iSEE.

runLocal

A logical indicating whether the app is to be run locally or remotely on a server, which determines how documentation will be accessed.

voice

A logical indicating whether the voice recognition should be enabled.

bugs

Set to TRUE to enable the bugs Easter egg. Alternatively, a named numeric vector control the respective number of each bug type (e.g., c(bugs=3L, spiders=1L)).

saveState

A function that accepts a single argument containing the current application state and saves it to some appropriate location.

...

Further arguments to pass to shinyApp.

Details

Configuring the initial state of the app is as easy as passing a list of Panel objects to initial. Each element represents one panel and is typically constructed with a command like ReducedDimensionPlot(). Panels are filled from left to right in a row-wise manner depending on the available width. Each panel can be easily customized by modifying the parameters in each object.

The extra argument should specify Panel classes that might not be shown during initialization but can be added interactively by the user after the app has started. The first instance of each new class in extra will be used as a template when the user adds a new panel of that class. Note that initial will automatically be appended to extra to form the final set of available panels, so it is not strictly necessary to re-specify instances of those initial panels in extra. (unless we want the parameters of newly created panels to be different from those at initialization).

Value

A Shiny app object is returned for interactive data exploration of se, either by simply printing the object or by explicitly running it with runApp.

Setting up a tour

The tour argument allows users to specify a custom tour to walk their audience through various panels. This is useful for describing different aspects of the dataset and highlighting interesting points in an interactive manner.

We use the format expected by the rintrojs package - see https://github.com/carlganz/rintrojs#usage for more information. There should be two columns, element and intro, with the former describing the element to highlight and the latter providing some descriptive text. The defaultTour also provides the default tour that is used in the Examples below.

Creating a landing page

If se is not supplied, a landing page is generated that allows users to upload their own RDS file to initialize the app. By default, the maximum request size for file uploads defaults to 5MB (https://shiny.rstudio.com/reference/shiny/0.14/shiny-options.html). To raise the limit (e.g., 50MB), run options(shiny.maxRequestSize=50*1024^2).

The landingPage argument can be used to alter the landing page, see createLandingPage for more details. This is useful for creating front-ends that can retrieve SummarizedExperiments from a database on demand for interactive visualization.

Saving application state

If users want to record the application state, they can download an RDS file containing a list with the entries:

  • memory, a list of Panel objects containing the current state of the application. This can be directly re-used as the initial argument in a subsequent iSEE call.

  • se, the SummarizedExperiment object of interest. This is optional and may not be present in the list, depending on the user specifications.

  • colormap, the ExperimentColorMap object being used. This is optional and may not be present in the list, depending on the user specifications.

We can also provide a custom function in saveState that accepts a single argument containing this list. This is most useful when iSEE is deployed in an enterprise environment where sessions can be saved in a persistent location; combined with a suitable landingPage specification, this allows users to easily reload sessions of interest. The idea is very similar to Shiny bookmarks but is more customizable and can be used in conjunction with URL-based bookmarking.

References

Rue-Albrecht K, Marini F, Soneson C, Lun ATL. iSEE: Interactive SummarizedExperiment Explorer F1000Research 7.

Javascript code for bugs was based on https://github.com/Auz/Bug.

Examples

library(scRNAseq)

# Example data ----
sce <- ReprocessedAllenData(assays="tophat_counts")
class(sce)

library(scater)
sce <- logNormCounts(sce, exprs_values="tophat_counts")

sce <- runPCA(sce, ncomponents=4)
sce <- runTSNE(sce)
rowData(sce)$ave_count <- rowMeans(assay(sce, "tophat_counts"))
rowData(sce)$n_cells <- rowSums(assay(sce, "tophat_counts") > 0)
sce

# launch the app itself ----

app <- iSEE(sce)
if (interactive()) {
  shiny::runApp(app, port=1234)
}


csoneson/iSEE documentation built on Dec. 13, 2024, 6:14 a.m.