Description Usage Arguments Details Value See Also Examples
View source: R/spatialCluster.R
Cluster a spatial expression dataset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | spatialCluster(
sce,
q,
use.dimred = "PCA",
d = 15,
platform = c("Visium", "ST"),
init = NULL,
init.method = c("mclust", "kmeans"),
model = c("t", "normal"),
precision = c("equal", "variable"),
nrep = 50000,
burn.in = 1000,
gamma = NULL,
mu0 = NULL,
lambda0 = NULL,
alpha = 1,
beta = 0.01,
save.chain = FALSE,
chain.fname = NULL
)
|
sce |
A SingleCellExperiment object containing the spatial data. |
q |
The number of clusters. |
use.dimred |
Name of a reduced dimensionality result in
|
d |
Number of top principal components to use when clustering. |
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
|
init |
Initial cluster assignments for spots. |
init.method |
If |
model |
Error model. ('normal' or 't') |
precision |
Covariance structure. ('equal' or 'variable' for EEE and VVV covariance models, respectively.) |
nrep |
The number of MCMC iterations. |
burn.in |
The number of MCMC iterations to exclude as burn-in period. |
gamma |
Smoothing parameter. Defaults to 2 for |
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. |
The input SCE must have row
and col
columns in its
colData
, corresponding to the array row and column coordinates of each
spot. These are automatically parsed by readVisium
or can be
added manually when creating the SCE.
Cluster labels are stored in the spatial.cluster
column of the SCE,
and the cluster initialization is stored in cluster.init
.
Returns a modified sce
with cluster assignments stored in
colData
under the name spatial.cluster
.
spatialPreprocess
for preparing the SCE for
clustering, spatialEnhance
for enhancing the clustering
resolution, clusterPlot
for visualizing the cluster
assignments, featurePlot
for visualizing expression levels
in spatial context, and mcmcChain
for examining the full
MCMC chain associated with the clustering.
1 2 3 | set.seed(149)
sce <- exampleSCE()
sce <- spatialCluster(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.