Skip to contents

Performs clustering on a SpatialExperiment using either expression data or selected result columns (deconvolution, pathway, or TF activity). Results are stored as new colData columns.

Usage

cluster(
  spe,
  method = c("kmeans", "hclust"),
  spmethod = c("expression", "progeny", "dorothea", "collectri",
    unname(deconvolution_methods)),
  dist_method = c("correlation", "euclidean", "maximum", "manhattan", "canberra",
    "binary", "minkowski"),
  hclust_method = c("complete", "ward.D", "ward.D2", "single", "average", "mcquitty",
    "median", "centroid"),
  nclusters = 3,
  pca_dim = seq(1, 30),
  clusres = 0.5,
  ...
)

Arguments

spe

A SpatialExperiment object containing the data to be clustered.

method

Clustering method: "kmeans" or "hclust".

spmethod

Data to cluster: "expression", "progeny", "dorothea", "collectri", or a deconvolution method token.

dist_method

Distance metric for "hclust": "correlation", "euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski".

hclust_method

Agglomeration method for "hclust": "complete", "ward.D", "ward.D2", "single", "average", "mcquitty", "median", "centroid".

nclusters

Number of clusters to create.

pca_dim

PCA dimensions used for expression clustering.

clusres

Resolution for Seurat-based expression clustering.

...

Additional parameters for clustering methods.

Value

SpatialExperiment with added clustering results in colData.