moscot.problems.spatiotemporal.SpatioTemporalProblem.sankey

SpatioTemporalProblem.sankey(source, target, source_groups, target_groups, threshold=None, normalize=False, forward=True, restrict_to_existing=True, order_annotations=None, key_added='sankey', **kwargs)

Compute a Sankey diagram between cells across time points.

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.

  • threshold (Optional[float]) – Set cell transitions lower than threshold to \(0\).

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

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

  • restrict_to_existing (bool) – TODO(MUCDK)

  • order_annotations (Optional[Sequence[str]]) – Order of annotations from top to bottom. If None, use the order defined by the categories.

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

  • kwargs (Any) – Keyword arguments for cell_transition().

  • self (TemporalMixinProtocol[K, B])

Return type:

Optional[list[DataFrame]]

Returns:

: Depending on the key_added: