MappingProblem.spatial_correspondence(interval=10, max_dist=None, attr=None)

Compute structural correspondence between spatial and molecular distances.

  • interval (Union[int, ndarray[Any, dtype[float64]]]) – Interval for the spatial distance. If int, it will be set from the data.

  • max_dist (Optional[int]) – Maximum distance for the interval. If None, it will set from the data.

  • attr (Optional[Dict[str, Optional[str]]]) –

    How to extract the data for correspondence. Valid options are:

    • None - use X.

    • dict - key corresponds to an attribute of AnnData and value to a key in that attribute. If the value is None, only the attribute will be used.

  • self (SpatialMappingMixinProtocol[K, B])

Return type:



: A dataframe with the following columns:

  • 'features_distance' - average spatial distance.

  • 'index_interval' - index of the interval.

  • 'value_interval' - average expression distance.

  • '{batch_key}' key of the batch (slide).