Run official SpaTalk for single-cell spatial data or spot data with a single-cell reference. Results are stored as a compact method bundle and added to SCOP's unified CCC table.
Usage
RunSpaTalk(
object,
group.by,
mode = c("auto", "single_cell", "spot"),
reference = NULL,
reference.group.by = NULL,
species = c("Human", "Mouse"),
assay = NULL,
layer = "counts",
reference.assay = NULL,
reference.layer = "counts",
image = NULL,
coord.cols = c("col", "row"),
deconvolution = c("NNLM", "RCTD", "none"),
rctd.tool = "RCTD",
result.name = "default",
store.object = c("minimal", "full"),
overwrite = FALSE,
backend = c("cpp", "r"),
verbose = TRUE,
srt = NULL,
...
)Arguments
- object
A `Seurat` spatial object.
- group.by
Metadata column containing cell labels for single-cell mode.
- mode
Analysis mode. `"auto"` selects spot mode when `reference` is supplied and single-cell mode otherwise.
- reference
Optional single-cell `Seurat` reference for spot mode.
- reference.group.by
Cell-type column in `reference`.
- species
SpaTalk species database.
- assay, layer
Spatial assay and raw-count layer.
- reference.assay, reference.layer
Reference assay and raw-count layer.
- image
Explicit spatial image. Required for multi-image objects.
- coord.cols
Metadata coordinate columns used when no image is present.
- deconvolution
Spot deconvolution mode. `"NNLM"` runs SpaTalk method 1; `"RCTD"` reuses `srt@tools[[rctd.tool]]$weights` from [RunRCTD()] (or an explicitly supplied `dec_result`); `"none"` requires a named external `dec_result` matrix in `...`. Imported matrices use SpaTalk method 2.
- rctd.tool
Tool key containing stored RCTD weights when `deconvolution = "RCTD"`.
- result.name
Stored result name.
- store.object
Whether to store the full upstream SpaTalk object.
- overwrite
Whether to replace an existing named result.
- backend
Backend used only for SCOP CCC result aggregation.
- verbose
Whether to print progress messages.
- srt
Deprecated alias for `object`; supply exactly one of the two. It will be removed in scop 1.0.0.
- ...
Arguments passed to other functions.
Examples
if (FALSE) { # \dontrun{
example_dir <- system.file("extdata", package = "SpaTalk")
load(file.path(example_dir, "starmap_data.rda"))
load(file.path(example_dir, "starmap_meta.rda"))
rownames(starmap_meta) <- starmap_meta$cell
spatial <- SeuratObject::CreateSeuratObject(
counts = Matrix::Matrix(as.matrix(starmap_data), sparse = TRUE),
meta.data = starmap_meta
)
set.seed(1)
spatial <- RunSpaTalk(
spatial, group.by = "celltype", mode = "single_cell",
species = "Mouse", coord.cols = c("x", "y"),
if_doParallel = FALSE, backend = "r"
)
SpaTalkPlot(spatial, plot_type = "network")
SpaTalkPlot(spatial, plot_type = "bubble", top_n = 8)
SpaTalkPlot(spatial, plot_type = "pathway", top_n = 8)
SpaTalkPlot(spatial, plot_type = "tf")
CCCNetworkPlot(spatial, method = "SpaTalk", plot_type = "spatial")
} # }