Interactive spatial feature viewer
FeatureViewer.Rd
FeatureViewer
opens up an interactive shiny application where
one can zoom and pan the H&E image while overlaying and color selected features.
It is also possible to add new categorical features or modify existing
categorical features with a lasso tool.
Usage
FeatureViewer(
object,
slot = "data",
datadir = NULL,
selected_features = NULL,
sampleIDs = NULL,
host = "127.0.0.1",
port = 8080L,
custom_color_palettes = NULL,
categorical_colors = NULL,
container_width = 800,
container_height = 800,
nCores = detectCores() - 1,
launch.browser = TRUE,
verbose = TRUE
)
Arguments
- object
A
Seurat
object created withsemla
- slot
A slot to use for Assay data
- datadir
A directory containing spatial data and image tiles (see
ExportDataForViewer
)- selected_features
A character vector of features to select for the viewer. These features need to be present in the 'default assay' or they can be names of dimensionality reduction vectors.
- sampleIDs
An integer vector of section IDs to use include in the viewer. All sections will be used by default. Note that if you have exported the data with
ExportDataForViewer
, you need to make sure that the sampleIDs forFeatureViewers
matches the sampleIDs used forExportDataForViewer
.- host
A string with a valid IPv4 or IPv6 address to listen on, Defaults to localhost "127.0.0.1"
- port
An integer that indicates the port to listen on.
- custom_color_palettes
A named list of color vectors to use as custom color palettes
- categorical_colors
A named list of character vectors with color names. The name of each character vector should correspond to a categorical variable in the meta.data slot of the
Seurat
object. Each character vector should be named where each name corresponds to a label of the category.- container_width, container_height
Set height and width of container
- nCores
Number of cores to use for threading passed to
TileImage
. Only used ifdatadir
is unavailable.- launch.browser
Select browser to use. See
runApp
for details- verbose
Print messages
Details
The viewer requires a tiled H&E image along with some additional image data to work. By default,
the function will attempt to create these files and export them to a temporary directory, but it
is also possible to export the files before running the app and provide the path to the
data directory with datadir
(see ExportDataForViewer
).
A more detailed tutorial can be found on the semla
website. You can also
get more detailed instructions by pressing the help icon in the app.
Selecting features
FeatureViewer
automatically selects the features in the 'default assay' and
dimensionality reduction vectors. You can override this selection with selected_features
,
but note that these have to be present in the 'default assay' or in the dimensionality reduction
slot. This is to avoid naming conflicts when multiple assay are present which contains identical
identifiers, for instance 'Spatial' and 'SCT'.
Non-finite values
If there are non-finite values present, e.g. NA or NaN, a warning will be thrown and these values
will be replaced with a 0. Alternatively, you can remove spots from the Seurat
object
which contain non-finite values before launching the viewer.
Examples
A tutorial can be found on our [package website](https://ludvigla.github.io/semla/). Go to tutorials -> Feature Viewer
See also
Other feature-viewer-methods:
ExportDataForViewer()
Other spatial-visualization-methods:
AnglePlot()
,
ImagePlot()
,
MapFeatures()
,
MapFeaturesSummary()
,
MapLabels()
,
MapLabelsSummary()
,
MapMultipleFeatures()