multiCluster: Cluster seurat object at several resolutions

View source: R/analysis_functions.R

multiClusterR Documentation

Cluster seurat object at several resolutions

Description

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

Usage

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

Author(s)

Nicholas Mikolajewicz

See Also

FindClusters

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)

plt.umap_by_cluster <- mc.list$plots
so.query <- mc.list$object
cr_names <- mc.list$resolution_names
cluster.name <- mc.list$cluster_names
assay.pattern <- mc.list$assay_pattern

NMikolajewicz/scMiko documentation built on June 28, 2023, 1:41 p.m.