spatialleiden.search_resolution

spatialleiden.search_resolution(adata, ncluster, *, start=(1.0, 0.4), step=0.1, n_iterations=15, latent_kwargs=None, spatial_kwargs=None)

Search the resolutions of the topological and latent layer to obtain n clusters using SpatialLeiden clustering.

Parameters:
  • adata (AnnData)

  • ncluster (int) – Number of clusters.

  • start (float, optional) – Starting point for resolution.

  • step (float, optional) – Increment if cluster number is incorrect.

  • n_iterations (int, optional) – Maximum number of iterations before stopping. If correct number of clusters is obtained it will stop early.

  • latent_kwargs (dict | None, optional) – Keyword arguments passed to scanpy.tl.leiden().

  • spatial_kwargs (dict | None, optional) – Keyword arguments passed to spatialleiden.spatialleiden().

Returns:

Target resolution for the latent and topological space.

Return type:

tuple[float, float]