Assign barcode spots to clusters according to different clustering algorithms.

findMonocleClusters(
  object,
  preprocess_method = c("PCA", "LSI"),
  reduction_method = c("UMAP", "tSNE", "PCA", "LSI"),
  cluster_method = c("leiden", "louvain"),
  k = 20,
  num_iter = 5,
  prefix = "Cluster ",
  verbose = TRUE,
  of_sample = NA
)

Arguments

object

A valid spata-object.

preprocess_method

Monocle3 - description:

A string specifying the initial dimension method to use, currently either PCA or LSI. For LSI (latent semantic indexing), it converts the (sparse) expression matrix into tf-idf matrix and then performs SVD to decompose the gene expression / cells into certain modules / topics. Default is "PCA".

reduction_method

Monocle3 - description:

A character string specifying the algorithm to use for dimensionality reduction. Currently "UMAP", "tSNE", "PCA" and "LSI" are supported.

cluster_method

Monocle3 - description:

String indicating the clustering method to use. Options are "louvain" or "leiden". Default is "leiden". Resolution parameter is ignored if set to "louvain".

k

Monocle3 - description:

Integer number of nearest neighbors to use when creating the k nearest neighbor graph for Louvain/Leiden clustering. k is related to the resolution of the clustering result, a bigger k will result in lower resolution and vice versa. Default is 20.

num_iter

Monocle3 - description:

Integer number of iterations used for Louvain/Leiden clustering. The clustering result giving the largest modularity score will be used as the final clustering result. Default is 1. Note that if num_iter is greater than 1, the random_seed argument will be ignored for the louvain method.

prefix

Character value. Clustering algorithms often return only numbers as names for the clusters they generate. If you want to these numbers to have a certain prefix (like 'Cluster', the default) you can specify it with this argument.

Value

A tidy spata-data.frame containing the cluster variables.

Details

This functions is a wrapper around all monocle3-cluster algorithms which take several options for dimensional reduction upon which the subsequent clustering bases. It iterates over all specified methods and returns a tidy data.frame in which each row represents one barcode-spot uniquely identified by the variable barcodes and in which every other variable about the cluster belonging the specified combination of methods returned. E.g.:

A call to findMonocleClusters() with

  • preprocess_method set to 'PCA'

  • reduction_method set to c('UMAP', 'PCA')

  • 'leiden', k set to 5

will return a data.frame of the following variables:

  • barcodes

  • mncl_cluster_UMAP_leiden_k5

  • mncl_cluster_PCA_leiden_k5

Due to the barcodes-variable it can be easily joined to your-spata object via addFeature(). and thus be made available for all spata-functions.