spatialleiden.spatialleiden_multimodal

spatialleiden.spatialleiden_multimodal(mdata, *, resolution=1, key_added='spatialleiden', directed=True, use_weights=True, n_iterations=-1, partition_type=<class 'leidenalg.VertexPartition.RBConfigurationVertexPartition'>, layer_weights=1, neighbors_key='connectivities', spatial_neighbors_key='spatial_connectivities', partition_kwargs=None, random_state=42)

Perform multimodal SpatialLeiden clustering.

This is a wrapper around spatialleiden.multiplex_leiden() that uses mudata.MuData as input and works with multiple layers; one for each modality and one for the spatial layer.

Parameters:
  • mdata (MuData)

  • resolution (float, Mapping[str, float], optional) – Resolution for the neighbor graphs of the different modalities and the spactial layer.

  • key_added (str, optional) – Key to store the clustering results in mudata.MuData.obs.

  • directed (bool | Mapping[str, bool], optional) – Whether to use a directed graph for the neighbor graphs of the modalities and the spatial layer.

  • use_weights (bool | Mapping[str, bool], optional) – Whether to use a weighted edges for the neighbor graphs of the modalities and the spatial layer.

  • n_iterations (int, optional) – Number of iterations to run the Leiden algorithm. If the number is negative it runs until convergence.

  • partition_type (Type[leidenalg.VertexPartition.MutableVertexPartition], optional) – A leidenalg.VertexPartition.MutableVertexPartition to be used.

  • layer_weights (float | Mapping[str, float], optional) – The weighting of the different layers.

  • neighbors_key (str | Mapping[str, str], optional) – Key(s) used to lookup the neighbor graphs for the different modalities in the corresponding anndata.AnnData.obsp.

  • spatial_neighbors_key (str, optional) – Key used to lookup the spatial neighbors graph in mudata.MuData.obsp.

  • partition_kwargs (None | Mapping[str, dict[str, Any]], optional) – Keyword arguments for the modality and spatial partitions.

  • random_state (int, optional) – Random seed.