Selector plot {scran}R Documentation

Construct a selector plot via Shiny

Description

Generate an interactive Shiny plot in which cells can be selected for further analysis.

Usage

selectorPlot(x, y, persist=FALSE, plot.width=5, plot.height=500, run=TRUE, pch=16, ...)

Arguments

x, y

Numeric vectors of x-y coordinates, of length equal to the number of cells.

persist

A logical scalar indicating whether selections should persist after stopping the app.

plot.width

A numeric scalar specifying the plot width, see width in ?column.

plot.height

A numeric scalar specifying the plot height in pixels.

run

A logical scalar specifying whether the Shiny app should be run.

pch, ...

Other arguments to pass to plot.

Details

Note that this function is deprecated; we suggest using the iSEE package for data exploration and point selection instead.

This function will return a Shiny app object that can be run with runApp. The aim is to perform dimensionality reduction to obtain coordinates for each cell, e.g., from PCA or t-SNE. These coordinates can be plotted with selectorPlot, and subpopulations of interest can be interactively selected. The selections can then be saved for further manipulation in R.

The app allows users to select groups of cells; mark them as cells of interest; and then save the marked cells into a list. Currently marked cells will be shown in red, previously saved cells are shown in orange, and all other cells are shown in grey. The distribution of saved cells is also shown in a separate plot indicating the list element to which they were saved. This can be repeated multiple times to obtain several groups of interest.

Several buttons are available within the app:

“Select”:

Marks the current selection of cells.

“Deselect”:

Unmarks the current selection of cells.

“Clear selection”:

Unmarks all currently marked cells.

“Add to list”:

Saves currently marked cells into a list.

“Reset all”:

Removes all marking, removes all saved cells from the list.

“Save list to R”:

Stops the app and returns the list of saved cells to R.

Value

If run=FALSE, a Shiny app object is returned, which can be run with runApp. This transfers control to a browser window where cells can be selected. Upon stopping the app with the “Save list to R” button, control is transferred back to R and the list of saved cells is returned. Each element of the list is a logical vector indicating which cells were saved in that group of interest.

If run=TRUE, a Shiny app object is created and run. This returns a list of saved cells upon stopping the app as previously described.

Author(s)

Aaron Lun

See Also

runApp

Examples

# Setting up PCs.
example(SingleCellExperiment)
pcs <- reducedDim(sce, "PCA")
x <- pcs[,1]
y <- pcs[,2]

# Creating the app object.
app <- selectorPlot(x, y, run=FALSE)
if (interactive()) { saved <- shiny::runApp(app) }

## Not run: # Running the app directly from the function.
saved <- selectorPlot(x, y)

## End(Not run)

[Package scran version 1.8.4 Index]