Skip to contents

Cluster an adjacency matrix

Usage

cluster_graph_leiden(
  snn,
  resolution = 1,
  objective_function = c("modularity", "CPM"),
  seed = 12531,
  ...
)

cluster_graph_louvain(snn, resolution = 1, seed = 12531)

cluster_graph_seurat(snn, resolution = 0.8, ...)

Arguments

snn

Symmetric adjacency matrix (dgCMatrix) output from e.g. knn_to_snn_graph() or knn_to_geodesic_graph(). Only the lower triangle is used

resolution

Resolution parameter. Higher values result in more clusters

objective_function

Graph statistic to optimize during clustering. Modularity is the default as it keeps resolution independent of dataset size (see details below). For the meaning of each option, see igraph::cluster_leiden().

seed

Random seed for clustering initialization

...

Additional arguments to underlying clustering function

Value

Factor vector containing the cluster assignment for each cell.

Details

cluster_graph_leiden: Leiden clustering algorithm igraph::cluster_leiden(). Note that when using objective_function = "CPM" the number of clusters empirically scales with cells * resolution, so 1e-3 is a good resolution for 10k cells, but 1M cells is better with a 1e-5 resolution. A resolution of 1 is a good default when objective_function = "modularity" per the default.

cluster_graph_louvain: Louvain graph clustering algorithm igraph::cluster_louvain()

cluster_graph_seurat: Seurat's clustering algorithm Seurat::FindClusters()