extract_co_occurrence

FeatureExtractor.extract_co_occurrence(interval, algorithm=CoOccAlgo.OPT, num_processes=None)[source]

Extract co-occurrence for each cell individually.

TODO: add reset flag, that sets existing co-occurrence matrices to 0 before running co-occurrence algorithm.

Parameters
  • interval (Iterable[float]) – Distance intervals for which to calculate co-occurrence score.

  • algorithm (Union[str, CoOccAlgo]) –

    Co-occurrence function to use:

    • squidpy: use sq.gr.co_occurrence().

    • opt: use custom implementation which is optimised for a large number of pixels. This implementation avoids recalculation of distances, using the fact that coordinates in given images lie on a regular grid. Use opt for very large inputs.

  • num_processes (Optional[int]) – only for algorithm='opt'. Number if processes to use to compute scores.

Return type

None

Returns

  • Nothing, modifies adata

  • - Adds ``obsm`` entries (co_occurrence_{cluster1}_{cluster2})