Description Usage Arguments Details Value See Also Examples
View source: R/spatialEnhance.R
Backend calls iterate_deconv(), written in Rcpp.
Inputs are the same as spatialCluster()
except you have to specify
xdist and ydist instead of total dist...(maybe would be better to change
spatialCluster
to match this)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | spatialEnhance(
sce,
q,
platform = c("Visium", "ST"),
use.dimred = "PCA",
d = 15,
init = NULL,
init.method = c("spatialCluster", "mclust", "kmeans"),
model = c("t", "normal"),
nrep = 2e+05,
gamma = NULL,
mu0 = NULL,
lambda0 = NULL,
alpha = 1,
beta = 0.01,
save.chain = FALSE,
chain.fname = NULL,
burn.in = 10000,
jitter_scale = 5,
jitter_prior = 0.3,
verbose = FALSE
)
|
sce |
A SingleCellExperiment object containing the spatial data. |
q |
The number of clusters. |
platform |
Spatial transcriptomic platform. Specify 'Visium' for hex
lattice geometry or 'ST' for square lattice geometry. Specifying this
parameter is optional when analyzing SingleCellExperiments processed using
|
use.dimred |
Name of a reduced dimensionality result in
|
d |
Number of top principal components to use when clustering. |
init |
Initial cluster assignments for spots. |
init.method |
If |
model |
Error model. ('normal' or 't') |
nrep |
The number of MCMC iterations. |
gamma |
Smoothing parameter. (Values in range of 1-3 seem to work well.) |
mu0 |
Prior mean hyperparameter for mu. If not provided, mu0 is set to the mean of PCs over all spots. |
lambda0 |
Prior precision hyperparam for mu. If not provided, lambda0 is set to a diagonal matrix 0.01 I. |
alpha |
Hyperparameter for Wishart distributed precision lambda. |
beta |
Hyperparameter for Wishart distributed precision lambda. |
save.chain |
If true, save the MCMC chain to an HDF5 file. |
chain.fname |
File path for saved chain. Tempfile used if not provided. |
burn.in |
Number of iterations to exclude as burn-in period. The MCMC
iterations are currently thinned to every 100; accordingly |
jitter_scale |
Controls the amount of jittering. Small amounts of
jittering are more likely to be accepted but result in exploring the space
more slowly. We suggest tuning |
jitter_prior |
Scale factor for the prior variance, parameterized as the
proportion (default = 0.3) of the mean variance of the PCs.
We suggest making |
verbose |
Log progress to stderr. |
The enhanced SingleCellExperiment
has most of the properties of the
input SCE - rowData
, colData
, reducedDims
- but does
not include expression data in counts
or logcounts
. To impute
enhanced expression vectors, please use [enhanceFeatures()] after
running spatialEnhance
.
The colData
of the enhanced SingleCellExperiment
includes the
following columns to permit referencing the subspots in spatial context and
linking back to the original spots:
spot.idx
: Index of the spot this subspot belongs to (with
respect to the input SCE).
subspot.idx
: Index of the subspot within its parent spot.
spot.row
: Array row of the subspot's parent spot.
spot.col
: Array col of the subspot's parent spot.
row
: Array row of the subspot. This is the parent spot's row
plus an offset based on the subspot's position within the spot.
col
: Array col of the subspot. This is the parent spot's col
plus an offset based on the subspot's position within the spot.
imagerow
: Pixel row of the subspot. This is the parent spot's
row plus an offset based on the subspot's position within the spot.
imagecol
: Pixel col of the subspot. This is the parent spot's
col plus an offset based on the subspot's position within the spot.
Returns a new SingleCellExperiment object. By default, the
assays
of this object are empty, and the enhanced resolution PCs
are stored as a reduced dimensionality result accessible with
reducedDim(sce, 'PCA')
.
spatialCluster
for clustering at the spot level
before enhancing, clusterPlot
for visualizing the cluster
assignments, enhanceFeatures
for imputing enhanced
expression, and mcmcChain
for examining the full MCMC chain
associated with the enhanced clustering.
.
1 2 3 4 | set.seed(149)
sce <- exampleSCE()
sce <- spatialCluster(sce, 7, nrep=100, burn.in=10)
enhanced <- spatialEnhance(sce, 7, nrep=100, burn.in=10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.