cluster cells using a NN-network and the Leiden community detection algorithm as implemented in igraph
doLeidenClusterIgraph(
gobject,
spat_unit = NULL,
feat_type = NULL,
name = "leiden_clus",
nn_network_to_use = "sNN",
network_name = "sNN.pca",
objective_function = c("modularity", "CPM"),
weights = NULL,
resolution = 1,
resolution_parameter = deprecated(),
beta = 0.01,
initial_membership = NULL,
n_iterations = 1000,
return_gobject = TRUE,
set_seed = TRUE,
seed_number = 1234,
...
)
giotto object
spatial unit (e.g. "cell")
feature type (e.g. "rna", "dna", "protein")
name for cluster, default to "leiden_clus"
type of NN network to use (kNN vs sNN), default to "sNN"
name of NN network to use, default to "sNN.pca"
objective function for the leiden algo
weights of edges
resolution, default = 1
deprecated. Use `resolution` instead
leiden randomness
initial membership of cells for the partition
number of interations to run the Leiden algorithm.
boolean: return giotto object (default = TRUE)
set seed
number for seed
Arguments passed on to igraph::cluster_leiden
vertex_weights
the vertex weights used in the Leiden algorithm.
If this is not provided, it will be automatically determined on the basis
of the objective_function
. Please see the details of this function
how to interpret the vertex weights.
giotto object with new clusters appended to cell metadata
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.
Set weights = NULL to use the vertices weights associated with the igraph network. Set weights = NA if you don't want to use vertices weights
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
#> python already initialized in this session
#> active environment : '/usr/bin/python3'
#> python version : 3.10
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/bin/python3"
doLeidenClusterIgraph(g)
#> leiden_clus has already been used, will be overwritten
#> 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