Skip to contents

A function containing to cluster adaptively smoothed gene expression data.

Usage

p2_clustering(
  spe,
  batch = FALSE,
  batch_by = "None",
  threads = 1,
  clustParams = list(clust_c = 0, subclust_c = 0, iter.max = 30, k = 5, cluster.fun =
    "louvain")
)

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.

threads

a numeric value for the number of CPU cores to be used for the analysis. Default value set to 1.

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)
#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 Time 05:14:56"
spe$ClustSIGNAL |> head()
#> [1] 6 6 4 6 6 6
#> Levels: 1 2 3 4 5 6 7 8 9