Skip to contents

Performs clustering on data obtained from a SpatialExperiment object using specified methods. This function allows for clustering based on deconvolution results, expression data, pathway, or transcription factors (TF) analyses.

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

A character vector specifying the clustering method to use. Options are "kmeans" and "hclust". Default is c("kmeans", "hclust").

spmethod

A character vector indicating the type of analysis for clustering. Options include "expression", "progeny", "dorothea", "collectri", and names of deconvolution methods. Default is based on the available deconvolution methods.

dist_method

A character vector specifying the distance measure to be used for "hclust" method. Options include "correlation", "euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski".

hclust_method

A character vector indicating the agglomeration method to be used with "hclust". Options include "complete", "ward.D", "ward.D2", "single", "average", "mcquitty", "median", "centroid".

nclusters

An integer specifying the number of clusters to create. Default is 3.

pca_dim

An integer vector specifying PCA dimensions to be used for clustering of expression data. This is used with Seurat::FindNeighbors. Default is seq(1, 30).

clusres

A numeric value for the clustering resolution to be used with Seurat::FindClusters. Default is 0.5.

...

Additional parameters for clustering methods.

Value

A modified SpatialExperiment object with added clustering results.