Cluster seurat object at several resolutions. Wrapper for Seurat::FindClusters(...).

multiCluster(
  object,
  resolutions,
  assay = NULL,
  nworkers = 1,
  pca_var = 0.9,
  group_singletons = F,
  algorithm = 1,
  return_object = T,
  verbose = T
)

Arguments

object

Seurat object

resolutions

Numeric vector of resolutions to cluster object at.

assay

Seurat assay to use. If not specified, default assay is used.

nworkers

Number of workers for parallel implementation. Default is 1.

pca_var

If nearest neighbor graph is absent in object, FindNeighbors(...) is run using the numebr of principal components that explains `pca_var` fraction of variance.

group_singletons

Group singletons into nearest cluster. If FALSE, assign all singletons to a "singleton" group

algorithm

Algorithm for modularity optimization (1 = original Louvain algorithm; 2 = Louvain algorithm with multilevel refinement; 3 = SLM algorithm; 4 = Leiden algorithm). Leiden requires the leidenalg python.

return_object

Return seurat object with multi-resolution clusters in meta data if TRUE, otherwise return list containing additional results. Default is T.

verbose

Print progress. Default is TRUE.

Value

Seurat object

See also

FindClusters

Author

Nicholas Mikolajewicz

Examples

# clustering data
mc.list <- multiCluster(object = so.query,
                        resolutions = c(0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.75, 1) ,
                        assay = NULL, nworkers = 10,
                        pca_var = 0.9,
                        group_singletons = F,
                        algorithm = 1,
                        return_object = F)
#> Loading required package: foreach
#> Error in multiCluster(object = so.query, resolutions = c(0.05, 0.1, 0.2,     0.3, 0.4, 0.5, 0.75, 1), assay = NULL, nworkers = 10, pca_var = 0.9,     group_singletons = F, algorithm = 1, return_object = F): object 'so.query' not found

plt.umap_by_cluster <- mc.list$plots
#> Error in eval(expr, envir, enclos): object 'mc.list' not found
so.query <- mc.list$object
#> Error in eval(expr, envir, enclos): object 'mc.list' not found
cr_names <- mc.list$resolution_names
#> Error in eval(expr, envir, enclos): object 'mc.list' not found
cluster.name <- mc.list$cluster_names
#> Error in eval(expr, envir, enclos): object 'mc.list' not found
assay.pattern <- mc.list$assay_pattern
#> Error in eval(expr, envir, enclos): object 'mc.list' not found