Union[mudata._core.mudata.MuData, anndata._core.anndata.AnnData], resolution: Optional[Union[float, Sequence[float], Mapping[str, float]]] = None, mod_weights: Optional[Union[Sequence[float], Mapping[str, float]]] = None, random_state: int = 0, key_added: str = 'leiden', neighbors_key: Optional[str] = None, directed: bool = True, partition_type: Optional[Type[leidenalg.VertexPartition.LeidenMutableVertexPartition]] = None, partition_kwargs: Mapping[str, Any] = mappingproxy({}), **kwargs)#

Cluster cells using the Leiden algorithm.

This runs only the multiplex Leiden algorithm on the MuData object using connectivities of individual modalities (see documentation for more details). For that, scanpy.pp.neighbors() should be run first for each modality.

For taking use of mdata.obsp['connectivities'], it’s that should be used. See for details.

  • datamuon.MuData object.

  • resolution – Resolution parameter controlling coarseness of the clustering (higher values -> more clusters). To use different resolution per modality, dictionary {mod: value} or list/tuple [value_mod1, value_mod2, ...]. Single value to use the same resolution for all modalities.

  • mod_weights – Weight each modality controlling its contribution (higher values -> more important). To use different weight per modality, dictionary {mod: value} or list/tuple [value_mod1, value_mod2, ...]. Single value to use the same weight for all modalities.

  • random_state – Random seed for the optimization.

  • key_addedmdata.obs key where cluster labels to be added.

  • neighbors_key – Use neighbors connectivities as adjacency. If not specified, look for .obsp['connectivities'] in each modality. If specified, look for .obsp[.uns[neighbors_key]['connectivities_key']] in each modality for connectivities.

  • directed – Treat the graph as directed or undirected.

  • partition_type – Type of partition to use, RBConfigurationVertexPartition by default. See find_partition() for more details.

  • partition_kwargs – Arguments to be passed to the partition_type.

  • **kwargs – Arguments to be passed to optimizer.optimise_partition_multiplex().