Skip to contents

A function containing to cluster adaptively smoothed gene expression data.

Usage

p2_clustering(spe, batch, batch_by, clustParams)

Arguments

spe

SpatialExperiment object. For reclust = FALSE, the object should contain logcounts and PCA, but for reculst = TRUE, the object should contain smoothed gene expression.

batch

a logical parameter for whether or not to perform batch correction. Default value is FALSE.

batch_by

a character indicating name of colData(spe) column containing the batch names.

clustParams

a list of parameters for TwoStepParam clustering methods. The clustering parameters are in the order - centers (centers) for clustering with KmeansParam, centers (centers) for sub-clustering clusters with KmeansParam, maximum iterations (iter.max) for clustering with KmeansParam, k values (k) for clustering with NNGraphParam, and community detection method (cluster.fun) to use with NNGraphParam.

Value

SpatialExperiment object containing clusters generated from smoothed data.

Examples

data(example)

# For non-spatial clustering of normalised counts
spe <- clustSIGNAL::p2_clustering(spe, batch = FALSE, batch_by = "None",
                                 clustParams = list(0, 0, 30, 5, "louvain"))
#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 Time 01:21:09"
head(spe$clustSIGNAL)
#> [1] 6 6 4 6 6 6
#> Levels: 1 2 3 4 5 6 7 8 9