| Title: | Interactive Exploration of Cell-Resolution Spatial Transcriptomics with iSEE |
|---|---|
| Description: | Provides reusable iSEE panels for interactive exploration of cell-resolution spatial transcriptomics data stored in SpatialExperiment objects. Supports CosMx, Xenium and cell-segmented Visium HD data, with coordinated region selection across spatial visualisations, quality-control summaries and spatial analyses. Panels can be combined with standard iSEE panels to explore gene expression, spatial statistics, cellular neighbourhoods and spatial domains. |
| Authors: | Emile Danvin [aut, cre] (ORCID: <https://orcid.org/0009-0000-0913-6893>), Dario Righelli [aut] (ORCID: <https://orcid.org/0000-0003-1504-3583>) |
| Maintainer: | Emile Danvin <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.99.2 |
| Built: | 2026-11-18 23:58:05 UTC |
| Source: | https://github.com/BiocStaging/spiSEE |
Computes a k-nearest-neighbour graph on spatialCoords(spe) and stores it
as a column pairing (colPair(spe, name)). Because column pairings are
subset together with the cells, any region selected later reuses this
graph instead of rebuilding it.
buildSpatialGraph( spe, k = 20L, name = "spatial_knn", BNPARAM = BiocNeighbors::KmknnParam() )buildSpatialGraph( spe, k = 20L, name = "spatial_knn", BNPARAM = BiocNeighbors::KmknnParam() )
spe |
A |
k |
Number of neighbours per cell. The default, 20, is that of
|
name |
Name of the stored column pairing. |
BNPARAM |
A |
spe with colPair(spe, name) set.
computeNiches(), computeSpatialDomains().
# two zones of cell types on a 20 x 20 grid xy <- as.matrix(expand.grid(x = 1:20, y = 1:20)) type <- ifelse(xy[, "x"] <= 10, c("Tumor", "T.cells")[(seq_len(400) %% 5 == 0) + 1], c("Fibroblast", "T.cells")[(seq_len(400) %% 4 == 0) + 1]) counts <- matrix(seq_len(400 * 10) %% 7, 10, 400, dimnames = list(paste0("g", 1:10), paste0("c", 1:400))) spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = counts, logcounts = log1p(counts)), colData = S4Vectors::DataFrame(Level1 = type), spatialCoords = xy) spe <- buildSpatialGraph(spe, k = 8) SingleCellExperiment::colPairNames(spe)# two zones of cell types on a 20 x 20 grid xy <- as.matrix(expand.grid(x = 1:20, y = 1:20)) type <- ifelse(xy[, "x"] <= 10, c("Tumor", "T.cells")[(seq_len(400) %% 5 == 0) + 1], c("Fibroblast", "T.cells")[(seq_len(400) %% 4 == 0) + 1]) counts <- matrix(seq_len(400 * 10) %% 7, 10, 400, dimnames = list(paste0("g", 1:10), paste0("c", 1:400))) spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = counts, logcounts = log1p(counts)), colData = S4Vectors::DataFrame(Level1 = type), spatialCoords = xy) spe <- buildSpatialGraph(spe, k = 8) SingleCellExperiment::colPairNames(spe)
For every cell, computes the cell-type composition of its k nearest
spatial neighbours, then groups cells with similar surroundings by
k-means. Adds to colData: niche (factor, named after the two most
enriched cell types) and niche_entropy (Shannon entropy of the
neighbourhood, bits). Stores the composition as reducedDim(spe, "NicheComposition") and the niche x cell-type log2 enrichment in
metadata(spe)$spiSEE_niches.
computeNiches( spe, label_col, k = 20L, n_niches = 6L, include_self = FALSE, seed = 1L )computeNiches( spe, label_col, k = 20L, n_niches = 6L, include_self = FALSE, seed = 1L )
spe |
A |
label_col |
|
k |
Neighbours per cell (default 20, as |
n_niches |
Number of niches (k-means centres). |
include_self |
Count the cell itself in its neighbourhood. |
seed |
Random seed for k-means. |
spe with niche annotations added. Cells with an NA label get
NA niche.
buildSpatialGraph(), SpatialNichePanel().
# two zones of cell types on a 20 x 20 grid xy <- as.matrix(expand.grid(x = 1:20, y = 1:20)) type <- ifelse(xy[, "x"] <= 10, c("Tumor", "T.cells")[(seq_len(400) %% 5 == 0) + 1], c("Fibroblast", "T.cells")[(seq_len(400) %% 4 == 0) + 1]) counts <- matrix(seq_len(400 * 10) %% 7, 10, 400, dimnames = list(paste0("g", 1:10), paste0("c", 1:400))) spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = counts, logcounts = log1p(counts)), colData = S4Vectors::DataFrame(Level1 = type), spatialCoords = xy) spe <- computeNiches(spe, label_col = "Level1", k = 8, n_niches = 2) table(spe$niche, spe$Level1)# two zones of cell types on a 20 x 20 grid xy <- as.matrix(expand.grid(x = 1:20, y = 1:20)) type <- ifelse(xy[, "x"] <= 10, c("Tumor", "T.cells")[(seq_len(400) %% 5 == 0) + 1], c("Fibroblast", "T.cells")[(seq_len(400) %% 4 == 0) + 1]) counts <- matrix(seq_len(400 * 10) %% 7, 10, 400, dimnames = list(paste0("g", 1:10), paste0("c", 1:400))) spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = counts, logcounts = log1p(counts)), colData = S4Vectors::DataFrame(Level1 = type), spatialCoords = xy) spe <- computeNiches(spe, label_col = "Level1", k = 8, n_niches = 2) table(spe$niche, spe$Level1)
Clusters cells on their expression PCs concatenated with the average PCs
of their spatial neighbours (weight lambda; a simplified version of the
BANKSY idea). With lambda = 0 this is plain expression clustering, which
is also returned (expr_cluster) so the two can be compared side by side.
computeSpatialDomains( spe, k_spatial = 20L, lambda = 0.2, use_dimred = "PCA", n_pcs = 20L, k_graph = 20L, resolution = 0.8, seed = 1L )computeSpatialDomains( spe, k_spatial = 20L, lambda = 0.2, use_dimred = "PCA", n_pcs = 20L, k_graph = 20L, resolution = 0.8, seed = 1L )
spe |
A |
k_spatial |
Spatial neighbours used for the neighbourhood average
(default 20, as |
lambda |
Share (0-1) of the neighbourhood part. |
use_dimred |
Name of an existing |
n_pcs |
Number of PCs when computing PCA. |
k_graph |
Neighbours for the feature-space clustering graph. |
resolution |
Louvain resolution (higher = more domains). |
seed |
Random seed. |
spe with colData columns spatial_domain and expr_cluster.
The parameters are stored in metadata(spe)$spiSEE_domains;
Compute in SpatialNichePanel() reuses resolution and k_graph.
buildSpatialGraph(), SpatialNichePanel().
# two zones of cell types on a 20 x 20 grid xy <- as.matrix(expand.grid(x = 1:20, y = 1:20)) type <- ifelse(xy[, "x"] <= 10, c("Tumor", "T.cells")[(seq_len(400) %% 5 == 0) + 1], c("Fibroblast", "T.cells")[(seq_len(400) %% 4 == 0) + 1]) counts <- matrix(seq_len(400 * 10) %% 7, 10, 400, dimnames = list(paste0("g", 1:10), paste0("c", 1:400))) spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = counts, logcounts = log1p(counts)), colData = S4Vectors::DataFrame(Level1 = type), spatialCoords = xy) spe <- computeSpatialDomains(spe, k_spatial = 8, n_pcs = 3, k_graph = 10) table(spe$spatial_domain)# two zones of cell types on a 20 x 20 grid xy <- as.matrix(expand.grid(x = 1:20, y = 1:20)) type <- ifelse(xy[, "x"] <= 10, c("Tumor", "T.cells")[(seq_len(400) %% 5 == 0) + 1], c("Fibroblast", "T.cells")[(seq_len(400) %% 4 == 0) + 1]) counts <- matrix(seq_len(400 * 10) %% 7, 10, 400, dimnames = list(paste0("g", 1:10), paste0("c", 1:400))) spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = counts, logcounts = log1p(counts)), colData = S4Vectors::DataFrame(Level1 = type), spatialCoords = xy) spe <- computeSpatialDomains(spe, k_spatial = 8, n_pcs = 3, k_graph = 10) table(spe$spatial_domain)
iSEE panel with one boxplot per field of view (FOV) for each of several
QC metrics, on the FOVs selected on the SpatialMapPanel() (all FOVs
when nothing is selected). Useful to spot FOVs with weak staining or few
transcripts before filtering.
## S4 method for signature 'FOVStatsPanel' .fullName(x) ## S4 method for signature 'FOVStatsPanel' .panelColor(x) ## S4 method for signature 'FOVStatsPanel' .defineOutput(x) ## S4 method for signature 'FOVStatsPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'FOVStatsPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'FOVStatsPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'FOVStatsPanel' .createObservers(x, se, input, session, pObjects, rObjects) FOVStatsPanel(...)## S4 method for signature 'FOVStatsPanel' .fullName(x) ## S4 method for signature 'FOVStatsPanel' .panelColor(x) ## S4 method for signature 'FOVStatsPanel' .defineOutput(x) ## S4 method for signature 'FOVStatsPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'FOVStatsPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'FOVStatsPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'FOVStatsPanel' .createObservers(x, se, input, session, pObjects, rObjects) FOVStatsPanel(...)
x |
A panel instance (the class this page documents). |
se |
The |
select_info |
A list of selection information, passed by iSEE. |
... |
Slots, e.g. |
all_memory, all_contents
|
iSEE's full panel-state list and the
current selection contents of every panel, passed to
|
output, pObjects, rObjects
|
The app's Shiny output list and the persistent/reactive state environments iSEE passes to every panel method. |
input, session
|
The current Shiny |
By default the first six QC metrics of colData are shown, on their own
scale. A table in metadata(spe)$fov_stats replaces them, for instance
to show transformed values: a data.frame in long format with one row
per cell and metric and the columns fov (FOV id, as in spe$fov),
name (metric name, one facet each) and value (number).
A FOVStatsPanel object.
SpatialQCPanel() for the distribution of one metric,
FOVZoomPanel() for the cells of the selected FOVs.
FOVStatsPanel() # optional: transformed values, one row per cell and metric spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = matrix(1, 2, 6)), colData = S4Vectors::DataFrame(fov = rep(1:2, 3), total = 1:6), spatialCoords = matrix(runif(12), 6, 2, dimnames = list(NULL, c("x", "y")))) S4Vectors::metadata(spe)$fov_stats <- data.frame(fov = spe$fov, name = "log10 total", value = log10(spe$total))FOVStatsPanel() # optional: transformed values, one row per cell and metric spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = matrix(1, 2, 6)), colData = S4Vectors::DataFrame(fov = rep(1:2, 3), total = 1:6), spatialCoords = matrix(runif(12), 6, 2, dimnames = list(NULL, c("x", "y")))) S4Vectors::metadata(spe)$fov_stats <- data.frame(fov = spe$fov, name = "log10 total", value = log10(spe$total))
iSEE panel drawing the cell polygons of the FOVs selected on the
SpatialMapPanel(), coloured by a QC metric, with
SpaceTrooper::plotZoomFovsMap(). Needs a polygons column.
## S4 method for signature 'FOVZoomPanel' .fullName(x) ## S4 method for signature 'FOVZoomPanel' .panelColor(x) ## S4 method for signature 'FOVZoomPanel' .defineOutput(x) ## S4 method for signature 'FOVZoomPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'FOVZoomPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'FOVZoomPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'FOVZoomPanel' .createObservers(x, se, input, session, pObjects, rObjects) FOVZoomPanel(ColorBy = "", ...)## S4 method for signature 'FOVZoomPanel' .fullName(x) ## S4 method for signature 'FOVZoomPanel' .panelColor(x) ## S4 method for signature 'FOVZoomPanel' .defineOutput(x) ## S4 method for signature 'FOVZoomPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'FOVZoomPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'FOVZoomPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'FOVZoomPanel' .createObservers(x, se, input, session, pObjects, rObjects) FOVZoomPanel(ColorBy = "", ...)
x |
A panel instance (the class this page documents). |
se |
The |
select_info |
A list of selection information, passed by iSEE. |
... |
Other slots, e.g. |
all_memory, all_contents
|
iSEE's full panel-state list and the
current selection contents of every panel, passed to
|
output, pObjects, rObjects
|
The app's Shiny output list and the persistent/reactive state environments iSEE passes to every panel method. |
input, session
|
The current Shiny |
ColorBy |
QC metric used to colour cell polygons. Empty = the first QC metric. |
A FOVZoomPanel object.
FOVStatsPanel(), SpatialQCPanel().
FOVZoomPanel(ColorBy = "QScore")FOVZoomPanel(ColorBy = "QScore")
Reads a CosMx SpatialExperiment saved as RDS and records the
platform. Such an object is typically made with
SpaceTrooper::readCosmxSPE() and the QC steps shown in the vignette
CosMx workflow: the mouse dentate gyrus. Optional extras used by the
app are described in spiSEE() (section Optional metadata).
loadCosmx(rds_path)loadCosmx(rds_path)
rds_path |
Path to the |
A SpatialExperiment.
loadXenium(), loadVisiumHD(), spiSEE().
dir <- system.file("extdata", "CosMx_DBKero_Tiny", package = "SpaceTrooper") f <- tempfile(fileext = ".rds") saveRDS(SpaceTrooper::readCosmxSPE(dir, sampleName = "DBKero"), f) spe <- loadCosmx(f)dir <- system.file("extdata", "CosMx_DBKero_Tiny", package = "SpaceTrooper") f <- tempfile(fileext = ".rds") saveRDS(SpaceTrooper::readCosmxSPE(dir, sampleName = "DBKero"), f) spe <- loadCosmx(f)
Reads the segmented_outputs folder of a Visium HD run (Space Ranger
cell segmentation) with VisiumIO::TENxVisiumHD(), as in the OSTA book
chapter "Visium HD (segmented)". Gene symbols become unique row names,
a logcounts assay is added if missing, and the platform is recorded.
For the full workflow (QC, annotation, niches) see
system.file("scripts", "visiumhd_osta_workflow.R", package = "spiSEE").
loadVisiumHD(segmented_outputs, images = "lowres")loadVisiumHD(segmented_outputs, images = "lowres")
segmented_outputs |
Path to the |
images |
Image resolution to load (passed to |
A SpatialExperiment.
loadCosmx(), loadXenium(), spiSEE().
d <- system.file("extdata", "segmented_outputs", package = "VisiumIO") if (requireNamespace("VisiumIO", quietly = TRUE) && requireNamespace("BiocIO", quietly = TRUE)) spe <- loadVisiumHD(d)d <- system.file("extdata", "segmented_outputs", package = "VisiumIO") if (requireNamespace("VisiumIO", quietly = TRUE) && requireNamespace("BiocIO", quietly = TRUE)) spe <- loadVisiumHD(d)
Reads the bundle with SpatialExperimentIO::readXeniumSXE(), adds
logcounts (log1p of counts) and, when cell_boundaries.parquet is
present, cell polygons via SpaceTrooper. Missing polygons are not an
error: the panels work on centroids.
loadXenium(xenium_dir)loadXenium(xenium_dir)
xenium_dir |
Path to an unzipped Xenium output directory. |
A SpatialExperiment.
loadCosmx(), loadVisiumHD(), spiSEE().
d <- system.file("extdata", "Xenium_small", package = "SpatialExperimentIO") if (requireNamespace("SpatialExperimentIO", quietly = TRUE)) spe <- loadXenium(d)d <- system.file("extdata", "Xenium_small", package = "SpatialExperimentIO") if (requireNamespace("SpatialExperimentIO", quietly = TRUE)) spe <- loadXenium(d)
Draws the cells of a SpatialExperiment as their polygons (or as points
if there are none), coloured by annotations, QC metrics or genes, with
the colours and legends of the app's spatial plots. Several values give
one panel each, on a shared colour scale.
plotSpatialCells( spe, colour_by, polygons = TRUE, palette = NULL, ncol = NULL, borders = FALSE, point_size = 0.3 )plotSpatialCells( spe, colour_by, polygons = TRUE, palette = NULL, ncol = NULL, borders = FALSE, point_size = 0.3 )
spe |
A |
colour_by |
One or more |
polygons |
Draw the cell polygons of a |
palette |
Named colours for categorical values (default: distinct colours, see the app). |
ncol |
Number of columns of panels. |
borders |
Draw cell borders (polygons only). |
point_size |
Point size when drawing points. |
A ggplot.
SpatialPlotPanel(), the same plot in the app.
dir <- system.file("extdata", "CosMx_DBKero_Tiny", package = "SpaceTrooper") if (nzchar(dir)) { spe <- SpaceTrooper::readCosmxSPE(dir, sampleName = "DBKero") spe <- SpaceTrooper::spatialPerCellQC(spe) spe <- SpaceTrooper::readAndAddPolygonsToSPE(spe) plotSpatialCells(spe, "Area_um") }dir <- system.file("extdata", "CosMx_DBKero_Tiny", package = "SpaceTrooper") if (nzchar(dir)) { spe <- SpaceTrooper::readCosmxSPE(dir, sampleName = "DBKero") spe <- SpaceTrooper::spatialPerCellQC(spe) spe <- SpaceTrooper::readAndAddPolygonsToSPE(spe) plotSpatialCells(spe, "Area_um") }
spiSEE adapts its panels to the platform: CosMx data are selected
by field of view (FOV), Xenium and Visium HD data by individual cells.
The platform is stored in metadata(spe)$spiSEE_platform; when it
is absent it is guessed from characteristic colData columns.
setPlatform(spe, platform = c("cosmx", "xenium", "visiumhd", "generic")) getPlatform(spe)setPlatform(spe, platform = c("cosmx", "xenium", "visiumhd", "generic")) getPlatform(spe)
spe |
A |
platform |
One of |
setPlatform() returns spe with the platform recorded;
getPlatform() returns the platform key (character).
spiSEE(), whose platform argument calls
setPlatform().
spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = matrix(1, 2, 3)), spatialCoords = matrix(runif(6), 3, 2, dimnames = list(NULL, c("x", "y")))) getPlatform(spe) spe <- setPlatform(spe, "xenium") getPlatform(spe)spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = matrix(1, 2, 3)), spatialCoords = matrix(runif(6), 3, 2, dimnames = list(NULL, c("x", "y")))) getPlatform(spe) spe <- setPlatform(spe, "xenium") getPlatform(spe)
Plot images and map backgrounds are cached on disk by spiSEE()
(argument cache). spatialCacheDir() gives the default folder for the
images (a plots subfolder of the package's user cache, next to the map
backgrounds); clearSpatialCache() deletes the cached images in a folder
and, for the default folder, the map backgrounds too.
spatialCacheDir() clearSpatialCache(dir = spatialCacheDir())spatialCacheDir() clearSpatialCache(dir = spatialCacheDir())
dir |
Cache folder. Only cache files ( |
spatialCacheDir(): the folder path. clearSpatialCache():
dir, invisibly.
spiSEE(), whose cache argument chooses the folder.
spatialCacheDir()spatialCacheDir()
Shows the whole tissue and lets the user pick FOVs (CosMx) or cells (Xenium, Visium HD) by clicking or dragging a rectangle. Selection happens in the browser; pressing Validate applies it to every spiSEE panel in the app (all classes extending SpatialPanelBase).
## S4 method for signature 'SpatialMapPanel' .fullName(x) ## S4 method for signature 'SpatialMapPanel' .panelColor(x) ## S4 method for signature 'SpatialMapPanel' .defineOutput(x) ## S4 method for signature 'SpatialMapPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialMapPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialMapPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialMapPanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialMapPanel(...)## S4 method for signature 'SpatialMapPanel' .fullName(x) ## S4 method for signature 'SpatialMapPanel' .panelColor(x) ## S4 method for signature 'SpatialMapPanel' .defineOutput(x) ## S4 method for signature 'SpatialMapPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialMapPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialMapPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialMapPanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialMapPanel(...)
x |
A panel instance (the class this page documents). |
se |
The |
select_info |
A list of selection information, passed by iSEE. |
... |
Slots passed to |
all_memory, all_contents
|
iSEE's full panel-state list and the
current selection contents of every panel, passed to
|
output, pObjects, rObjects
|
The app's Shiny output list and the persistent/reactive state environments iSEE passes to every panel method. |
input, session
|
The current Shiny |
A SpatialMapPanel object.
spiSEE(); SpatialPanelBase for the panels that
follow the selection.
SpatialMapPanel()SpatialMapPanel()
iSEE panel showing cellular niches (from the cell-type composition of
each cell's spatial neighbours) and spatial domains (clustering on
neighbourhood-augmented expression), on any platform. It follows the
selection of the SpatialMapPanel(). Results precomputed offline with
computeNiches() / computeSpatialDomains() are shown instantly when the
panel's parameters match them; Compute re-runs on the selection.
## S4 method for signature 'SpatialNichePanel' .refineParameters(x, se) ## S4 method for signature 'SpatialNichePanel' .fullName(x) ## S4 method for signature 'SpatialNichePanel' .panelColor(x) ## S4 method for signature 'SpatialNichePanel' .defineOutput(x) ## S4 method for signature 'SpatialNichePanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialNichePanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialNichePanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialNichePanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialNichePanel( PlotType = "niche_map", LabelCol = NA_character_, K = NA, NNiches = NA, Lambda = NA, UsePolygons = NA, ... )## S4 method for signature 'SpatialNichePanel' .refineParameters(x, se) ## S4 method for signature 'SpatialNichePanel' .fullName(x) ## S4 method for signature 'SpatialNichePanel' .panelColor(x) ## S4 method for signature 'SpatialNichePanel' .defineOutput(x) ## S4 method for signature 'SpatialNichePanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialNichePanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialNichePanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialNichePanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialNichePanel( PlotType = "niche_map", LabelCol = NA_character_, K = NA, NNiches = NA, Lambda = NA, UsePolygons = NA, ... )
x |
A panel instance (the class this page documents). |
se |
The |
select_info |
A list of selection information, passed by iSEE. |
... |
Other slots: |
all_memory, all_contents
|
iSEE's full panel-state list and the
current selection contents of every panel, passed to
|
output, pObjects, rObjects
|
The app's Shiny output list and the persistent/reactive state environments iSEE passes to every panel method. |
input, session
|
The current Shiny |
PlotType |
One of the values of the "Show" menu, e.g. |
LabelCol |
|
K, NNiches, Lambda
|
Neighbours per cell, number of niches, spatial
weight for domains. |
UsePolygons |
Draw real cell-shape polygons instead of a centroid
scatter on the "on tissue" plot types (needs a |
A SpatialNichePanel object.
computeNiches() and computeSpatialDomains(), which run the
same analyses outside the app.
SpatialNichePanel(K = 30, NNiches = 8)SpatialNichePanel(K = 30, NNiches = 8)
Virtual class extending iSEE::Panel. It adds a Selection slot
that the SpatialMapPanel() fills when the user presses Validate.
## S4 method for signature 'SpatialPanelBase' .createObservers(x, se, input, session, pObjects, rObjects)## S4 method for signature 'SpatialPanelBase' .createObservers(x, se, input, session, pObjects, rObjects)
x |
A panel extending |
se |
The |
input, session, pObjects, rObjects
|
Shiny and iSEE state, passed by iSEE. |
.createObservers() is called for its side effects (it gives a
panel added while the app runs the selection of the map) and returns
NULL.
SelectionComma-separated region identifiers (FOV ids or cell ids, depending on the platform). Empty string = whole dataset.
SpatialMapPanel(), which sets the selection.
# every spiSEE panel except the map follows the map selection is(SpatialPlotPanel(Selection = "1,2"), "SpatialPanelBase") SpatialPlotPanel(Selection = "1,2")[["Selection"]]# every spiSEE panel except the map follows the map selection is(SpatialPlotPanel(Selection = "1,2"), "SpatialPanelBase") SpatialPlotPanel(Selection = "1,2")[["Selection"]]
iSEE panel showing the cells of the region selected on the
SpatialMapPanel(), as centroids or as their segmentation polygons,
coloured by a cell annotation, a QC metric or the expression of a gene
(logcounts). It redraws as soon as the selection or a parameter
changes.
## S4 method for signature 'SpatialPlotPanel' .refineParameters(x, se) ## S4 method for signature 'SpatialPlotPanel' .fullName(x) ## S4 method for signature 'SpatialPlotPanel' .panelColor(x) ## S4 method for signature 'SpatialPlotPanel' .defineOutput(x) ## S4 method for signature 'SpatialPlotPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialPlotPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialPlotPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialPlotPanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialPlotPanel(ColorBy = "", UsePolygons = NA, PointSize = 0.5, ...)## S4 method for signature 'SpatialPlotPanel' .refineParameters(x, se) ## S4 method for signature 'SpatialPlotPanel' .fullName(x) ## S4 method for signature 'SpatialPlotPanel' .panelColor(x) ## S4 method for signature 'SpatialPlotPanel' .defineOutput(x) ## S4 method for signature 'SpatialPlotPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialPlotPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialPlotPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialPlotPanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialPlotPanel(ColorBy = "", UsePolygons = NA, PointSize = 0.5, ...)
x |
A panel instance (the class this page documents). |
se |
The |
select_info |
A list of selection information, passed by iSEE. |
... |
Other slots, e.g. |
all_memory, all_contents
|
iSEE's full panel-state list and the
current selection contents of every panel, passed to
|
output, pObjects, rObjects
|
The app's Shiny output list and the persistent/reactive state environments iSEE passes to every panel method. |
input, session
|
The current Shiny |
ColorBy |
A |
UsePolygons |
Draw segmentation polygons instead of centroids (needs
a |
PointSize |
Centroid size. |
A SpatialPlotPanel object.
plotSpatialCells() for the same plot outside the app.
SpatialPlotPanel(ColorBy = "total")SpatialPlotPanel(ColorBy = "total")
iSEE panel with the histogram of one QC metric (a numeric colData
column) over the cells of the region selected on the
SpatialMapPanel(). When SpaceTrooper's medcouple outlier detection has
been run (SpaceTrooper::computeSpatialOutlier(), which adds a column
<Metric>_outlier_mc), the outlier fences are drawn and the number of
flagged cells is given.
## S4 method for signature 'SpatialQCPanel' .fullName(x) ## S4 method for signature 'SpatialQCPanel' .panelColor(x) ## S4 method for signature 'SpatialQCPanel' .defineOutput(x) ## S4 method for signature 'SpatialQCPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialQCPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialQCPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialQCPanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialQCPanel(Metric = "", UseFences = TRUE, ...)## S4 method for signature 'SpatialQCPanel' .fullName(x) ## S4 method for signature 'SpatialQCPanel' .panelColor(x) ## S4 method for signature 'SpatialQCPanel' .defineOutput(x) ## S4 method for signature 'SpatialQCPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialQCPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialQCPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialQCPanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialQCPanel(Metric = "", UseFences = TRUE, ...)
x |
A panel instance (the class this page documents). |
se |
The |
select_info |
A list of selection information, passed by iSEE. |
... |
Other slots, e.g. |
all_memory, all_contents
|
iSEE's full panel-state list and the
current selection contents of every panel, passed to
|
output, pObjects, rObjects
|
The app's Shiny output list and the persistent/reactive state environments iSEE passes to every panel method. |
input, session
|
The current Shiny |
Metric |
A numeric |
UseFences |
Show medcouple outlier fences when a column
|
A SpatialQCPanel object.
FOVStatsPanel() for metrics per FOV, SpatialPlotPanel() to
see a metric on the tissue.
SpatialQCPanel(Metric = "total")SpatialQCPanel(Metric = "total")
Neighbour graph, global and local Moran's I, local cluster significance,
join-count statistics and L-functions, computed on the region selected
on the SpatialMapPanel() when the user presses Compute.
## S4 method for signature 'SpatialStatsPanel' .fullName(x) ## S4 method for signature 'SpatialStatsPanel' .panelColor(x) ## S4 method for signature 'SpatialStatsPanel' .defineOutput(x) ## S4 method for signature 'SpatialStatsPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialStatsPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialStatsPanel' .refineParameters(x, se) ## S4 method for signature 'SpatialStatsPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialStatsPanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialStatsPanel( PlotType = "graph_plot", Genes = character(0), LabelCol = NA_character_, K = 6L, Alpha = 0.05, ... )## S4 method for signature 'SpatialStatsPanel' .fullName(x) ## S4 method for signature 'SpatialStatsPanel' .panelColor(x) ## S4 method for signature 'SpatialStatsPanel' .defineOutput(x) ## S4 method for signature 'SpatialStatsPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SpatialStatsPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SpatialStatsPanel' .refineParameters(x, se) ## S4 method for signature 'SpatialStatsPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SpatialStatsPanel' .createObservers(x, se, input, session, pObjects, rObjects) SpatialStatsPanel( PlotType = "graph_plot", Genes = character(0), LabelCol = NA_character_, K = 6L, Alpha = 0.05, ... )
x |
A panel instance (the class this page documents). |
se |
The |
select_info |
A list of selection information, passed by iSEE. |
... |
Other slots: |
all_memory, all_contents
|
iSEE's full panel-state list and the
current selection contents of every panel, passed to
|
output, pObjects, rObjects
|
The app's Shiny output list and the persistent/reactive state environments iSEE passes to every panel method. |
input, session
|
The current Shiny |
PlotType |
One of |
Genes |
Genes for the Moran-type statistics. |
LabelCol |
Cell-type column ( |
K |
Number of spatial neighbours per cell. |
Alpha |
Significance level for the local cluster plot: a cell is
called significant when its adjusted p-value (local Moran's I) is
below |
The neighbour graph is a k-nearest-neighbour graph on the cell
centroids of the region. Moran's I and the local clusters come from
Voyager, the join counts from spdep. The L-function (lest_plot) is
computed for the most frequent cell type and the L-cross function
(lcross_plot) for the two most frequent ones (types with at least 10
cells), with spatialFDA, up to a radius of a quarter of the shorter
side of the region.
Changing a parameter does not recompute anything: results are computed on Compute and cached by what they compute (statistic, parameters, region and dataset), so the same analysis opens at once the next time.
A SpatialStatsPanel object.
SVGPanel() to rank genes by Moran's I, SpatialNichePanel()
for niches and domains.
SpatialStatsPanel(PlotType = "joincount_plot", K = 10)SpatialStatsPanel(PlotType = "joincount_plot", K = 10)
Opens an iSEE app whose panels adapt to the platform of spe (CosMx,
Xenium, Visium HD, or any SpatialExperiment). A selection made on the
overview map applies to every other panel.
spiSEE( spe, mode = c("analysis", "qc"), platform = NULL, selection = "", sample = NULL, initial = NULL, cache = getOption("spiSEE.cache", TRUE), cache_size = getOption("spiSEE.cache_size", 1024^3), title = "spiSEE", ... )spiSEE( spe, mode = c("analysis", "qc"), platform = NULL, selection = "", sample = NULL, initial = NULL, cache = getOption("spiSEE.cache", TRUE), cache_size = getOption("spiSEE.cache_size", 1024^3), title = "spiSEE", ... )
spe |
A |
mode |
|
platform |
Optional platform key to override detection
(see |
selection |
Initial selection: FOV or cell ids, as a character vector or one comma-separated string. Empty = whole dataset. Unknown ids are dropped with a warning. |
sample |
With several samples ( |
initial |
Optional list of panels; replaces the default layout. |
cache |
Where plot images are cached: |
cache_size |
Maximum size of the disk cache in bytes (default 1 GB); the least recently used images are removed first. |
title |
Title of the app (browser tab and header). |
... |
Passed to |
mode = "qc": map, spatial plot, two QC histograms (+ FOV zoom and
per-FOV summary for CosMx). Meant for unfiltered data.
mode = "analysis": map, two spatial plots (annotation and gene),
spatial statistics, spatially variable genes, niches and domains.
A Shiny app object (prints/launches in an interactive session).
Some entries of metadata(spe) are used when present:
gene_ranks: gene names, in the order of the gene menus and of the
genes scanned by SVGPanel() (default: by mean expression).
fov_stats: per-FOV values for FOVStatsPanel() (see there).
technology: as set by SpaceTrooper's readers; gives the unit of the
scale bars of the spatial plots (none without it).
fov_positions, fov_dim: FOV layout from
SpaceTrooper::readCosmxSPE(), drawn on the map (CosMx); without them
the tiles follow the extent of the cells of each FOV.
Niches and domains stored by computeNiches() and
computeSpatialDomains(): shown by SpatialNichePanel() without
recomputing.
SpatialMapPanel() and the other panels; spatialCacheDir().
spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = matrix(rpois(200, 3), 10, 20, dimnames = list(paste0("g", 1:10), paste0("c", 1:20)))), spatialCoords = matrix(runif(40), 20, 2, dimnames = list(NULL, c("x", "y")))) app <- spiSEE(spe, mode = "qc", cache = FALSE) if (interactive()) shiny::runApp(app)spe <- SpatialExperiment::SpatialExperiment( assays = list(counts = matrix(rpois(200, 3), 10, 20, dimnames = list(paste0("g", 1:10), paste0("c", 1:20)))), spatialCoords = matrix(runif(40), 20, 2, dimnames = list(NULL, c("x", "y")))) app <- spiSEE(spe, mode = "qc", cache = FALSE) if (interactive()) shiny::runApp(app)
iSEE panel with a table of genes ranked by Moran's I on the region
selected on the SpatialMapPanel(), computed on Compute (Voyager, on
a k-nearest-neighbour graph of the cell centroids). Clicking a row shows
the gene in a linked SpatialPlotPanel().
## S4 method for signature 'SVGPanel' .fullName(x) ## S4 method for signature 'SVGPanel' .panelColor(x) ## S4 method for signature 'SVGPanel' .defineOutput(x) ## S4 method for signature 'SVGPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SVGPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SVGPanel' .refineParameters(x, se) ## S4 method for signature 'SVGPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SVGPanel' .createObservers(x, se, input, session, pObjects, rObjects) SVGPanel(TopN = 200L, K = 6L, LinkedPanel = "", ...)## S4 method for signature 'SVGPanel' .fullName(x) ## S4 method for signature 'SVGPanel' .panelColor(x) ## S4 method for signature 'SVGPanel' .defineOutput(x) ## S4 method for signature 'SVGPanel' .defineInterface(x, se, select_info) ## S4 method for signature 'SVGPanel' .generateOutput(x, se, ..., all_memory, all_contents) ## S4 method for signature 'SVGPanel' .refineParameters(x, se) ## S4 method for signature 'SVGPanel' .renderOutput(x, se, output, pObjects, rObjects) ## S4 method for signature 'SVGPanel' .createObservers(x, se, input, session, pObjects, rObjects) SVGPanel(TopN = 200L, K = 6L, LinkedPanel = "", ...)
x |
A panel instance (the class this page documents). |
se |
The |
select_info |
A list of selection information, passed by iSEE. |
... |
Other slots: |
all_memory, all_contents
|
iSEE's full panel-state list and the
current selection contents of every panel, passed to
|
output, pObjects, rObjects
|
The app's Shiny output list and the persistent/reactive state environments iSEE passes to every panel method. |
input, session
|
The current Shiny |
TopN |
Number of most expressed genes to scan (or the first |
K |
Number of spatial neighbours per cell. |
LinkedPanel |
Name of a |
A SVGPanel object.
SpatialStatsPanel() for Moran's I of chosen genes.
SVGPanel(TopN = 100, LinkedPanel = "SpatialPlotPanel1")SVGPanel(TopN = 100, LinkedPanel = "SpatialPlotPanel1")