moscot.problems.spatiotemporal.SpatioTemporalProblem.cell_transition

SpatioTemporalProblem.cell_transition(source, target, source_groups, target_groups, forward=False, aggregation_mode='annotation', batch_size=None, normalize=True, key_added='cell_transition')

Aggregate the transport matrix.

See also

Parameters:
  • source (TypeVar(K, bound= Hashable)) – Key identifying the source distribution.

  • target (TypeVar(K, bound= Hashable)) – Key identifying the target distribution.

  • source_groups (Union[str, Mapping[str, Sequence[Any]], None]) –

    Source groups used for aggregation. Valid options are:

    • str - key in obs where categorical data is stored.

    • dict - a dictionary with one key corresponding to a categorical column in obs and values to a subset of categories.

  • target_groups (Union[str, Mapping[str, Sequence[Any]], None]) –

    Target groups used for aggregation. Valid options are:

    • str - key in obs where categorical data is stored.

    • dict - a dictionary with one key corresponding to a categorical column in obs and values to a subset of categories.

  • aggregation_mode (Literal['annotation', 'cell']) –

    How to aggregate the cell-level transport maps. Valid options are:

    • 'annotation' - group the transitions by the source_groups and the target_groups.

    • 'cell' - do not group by the source_groups or the target_groups, depending on the forward.

  • forward (bool) – If True, compute the transitions from the source_groups to the target_groups.

  • batch_size (Optional[int]) – Number of rows/columns of the cost matrix to materialize during push() or pull(). Larger value will require more memory.

  • normalize (bool) – If True, normalize the transition matrix. If forward = True, the transition matrix will be row-stochastic, otherwise column-stochastic.

  • key_added (Optional[str]) – Key in uns where to save the result.

  • self (TemporalMixinProtocol[K, B])

Return type:

Optional[DataFrame]

Returns:

: Depending on the key_added: