
Graph-based clustering of cells on the sNN graph
find_clusters_sc.RdThis function will apply Leiden clustering on the sNN graph with the given resolution and add a column to the obs table.
Arguments
- object
SingleCells,MetaCells(or potentially other) class.- cluster_algorithm
String. One of
c("leiden", "louvain").- res
Numeric. The resolution parameter for
igraph::cluster_leiden()origraph::cluster_louvain().- name
String. The name to add to the obs table in the DuckDB.
- modality
String. On which modality to run the UMAP. One of
c("rna", "adt", "wnn"). The two latter options are only available for multi-modal versions with the added data.- seed
Integer. For reproducibility.
Examples
# Leiden on the cached sNN graph
sc <- demo_single_cells()
sc <- find_clusters_sc(sc, res = 1.0, name = "clusters")
table(get_sc_obs(sc)$clusters)
#>
#> 0 1 2
#> 169 166 165
unlink(sc@dir_data, recursive = TRUE, force = TRUE)