moscot.problems.cross_modality.TranslationProblem.translate#

TranslationProblem.translate(source, target, forward=True, alternative_attr=None, **kwargs)#

Translate the source modality to the target modality.

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

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

  • forward (bool) – If True, translate the source modality to the target modality, otherwise vice-versa.

  • alternative_attr (Optional[Dict[str, Any]]) –

    Alternative embedding to translate. Valid option are:

    • None - use the features specified when preparing the problem.

    • str - key in obsm where the data is stored.

    • dict - it should contain 'attr' and 'key', the attribute and the key in AnnData.

  • kwargs (Any) – Keyword arguments for push() or pull(), depending on the forward.

  • self (CrossModalityTranslationMixinProtocol[K, B]) –

Return type:

ndarray[Any, dtype[float64]]

Returns:

: If forward = True, the translation of the source modality to the target modality, otherwise vice-versa.