Cluster cells using a NN-network and the Leiden community detection algorithm as implemented in igraph.
This function is a wrapper for the Leiden algorithm implemented in igraph,
which can detect communities in graphs of millions of nodes (cells),
as long as they can fit in memory. See cluster_leiden
for more information.
resolution | numeric (default = 1). Clustering resolution. |
n_iterations | numeric (default = 1000). Number of iterations to run the Leiden algorithm. |
weights | (default = NULL) weights of edges. Set NULL to use
weights associated with the igraph network. Set NA if you don't want
to use weights. |
beta | character (default = 0.01). Leiden randomness |
objective_function | character (default = "modularity") objective
function for the leiden algorithm. One of "modularity" or "CPM" |
initial_membership | (default = NULL) initial membership of cells
for the partition. |
g <- GiottoData::loadGiottoMini("visium")
#> 1. read Giotto object
#> 2. read Giotto feature information
#> 3. read Giotto spatial information
#> 3.1 read Giotto spatial shape information
#> 3.2 read Giotto spatial centroid information
#> 3.3 read Giotto spatial overlap information
#> 4. read Giotto image information
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/bin/python3"
#> Warning: Some of Giotto's expected python module(s) were not found:
#> pandas, igraph, leidenalg, community, networkx, sklearn
#> (This is fine if python-based functions are not needed)
#>
#> ** Python path used: "/usr/bin/python3"
clusterData(g, clusterParam("leiden_igraph", resolution = 0.5))
#> An object of class giotto
#> >Active spat_unit: cell
#> >Active feat_type: rna
#> dimensions : 634, 624 (features, cells)
#> [SUBCELLULAR INFO]
#> polygons : cell
#> [AGGREGATE INFO]
#> expression -----------------------
#> [cell][rna] raw normalized scaled
#> spatial locations ----------------
#> [cell] raw
#> spatial networks -----------------
#> [cell] Delaunay_network spatial_network
#> spatial enrichments --------------
#> [cell][rna] cluster_metagene DWLS
#> dim reduction --------------------
#> [cell][rna] pca custom_pca umap custom_umap tsne
#> nearest neighbor networks --------
#> [cell][rna] sNN.pca custom_NN
#> attached images ------------------
#> images : alignment image
#>
#>
#> Use objHistory() to see steps and params used