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
androwData
covariates.- landingPage
A function that renders a landing page when
iSEE
is started without any specifiedse
. Ignored ifse
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
.
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
.
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).
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 theinitial
argument in a subsequentiSEE
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)
#> [1] "SingleCellExperiment"
#> attr(,"package")
#> [1] "SingleCellExperiment"
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
#> class: SingleCellExperiment
#> dim: 20816 379
#> metadata(2): SuppInfo which_qc
#> assays(2): tophat_counts logcounts
#> rownames(20816): 0610007P14Rik 0610009B22Rik ... Zzef1 Zzz3
#> rowData names(2): ave_count n_cells
#> colnames(379): SRR2140028 SRR2140022 ... SRR2139341 SRR2139336
#> colData names(23): NREADS NALIGNED ... passes_qc_checks_s sizeFactor
#> reducedDimNames(2): PCA TSNE
#> mainExpName: endogenous
#> altExpNames(1): ERCC
# launch the app itself ----
app <- iSEE(sce)
if (interactive()) {
shiny::runApp(app, port=1234)
}