moscot.problems.cross_modality.TranslationProblem.prepare

TranslationProblem.prepare(src_attr, tgt_attr, joint_attr=None, batch_key=None, cost='sq_euclidean', cost_kwargs=mappingproxy({}), a=None, b=None, xy_callback=None, x_callback=None, y_callback=None, xy_callback_kwargs=mappingproxy({}), x_callback_kwargs=mappingproxy({}), y_callback_kwargs=mappingproxy({}), marginal_kwargs=mappingproxy({}), subset=None, reference=None)[source]

Prepare the translation problem.

See also

Parameters:
  • src_attr (Union[str, Mapping[str, Any]]) –

    How to get the data for the source modality:

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

    • dict - it should contain 'attr' and 'key', the attribute and the key in AnnData, and optionally 'tag', one of Tag.

    By default, tag = 'point_cloud' is used.

  • tgt_attr (Union[str, Mapping[str, Any]]) –

    How to get the data for the target modality:

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

    • dict - it should contain 'attr' and 'key', the attribute and the key in AnnData, and optionally 'tag', one of Tag.

    By default, tag = 'point_cloud' is used.

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

    How to get the data for the linear term in the fused case:

    By default, tag = 'point_cloud' is used.

  • batch_key (Optional[str]) – Key in obs specifying the batch.

  • cost (Union[Literal['euclidean', 'sq_euclidean', 'cosine', 'pnorm_p', 'sq_pnorm', 'geodesic'], Mapping[Literal['xy', 'x', 'y'], Literal['euclidean', 'sq_euclidean', 'cosine', 'pnorm_p', 'sq_pnorm', 'geodesic']]]) –

    Cost function to use. Valid options are:

    • str - name of the cost function for all terms, see get_available_costs().

    • dict - a dictionary with the following keys and values:

      • 'xy' - cost function for the linear term.

      • 'x' - cost function for the source modality.

      • 'y' - cost function for the target modality.

  • cost_kwargs (Union[Mapping[str, Any], Mapping[Literal['x', 'y', 'xy'], Mapping[str, Any]]]) – Keyword arguments for the BaseCost or any backend-specific cost.

  • a (Union[bool, str, None]) –

    Source marginals. Valid options are:

  • b (Union[bool, str, None]) –

    Target marginals. Valid options are:

  • xy_callback (Literal['local-pca'] | ~typing.Callable[[~typing.Literal['xy', 'x', 'y'], ~anndata._core.anndata.AnnData, ~anndata._core.anndata.AnnData | None], ~moscot.utils.tagged_array.TaggedArray | None] | None)

  • x_callback (Literal['local-pca'] | ~typing.Callable[[~typing.Literal['xy', 'x', 'y'], ~anndata._core.anndata.AnnData, ~anndata._core.anndata.AnnData | None], ~moscot.utils.tagged_array.TaggedArray | None] | None)

  • y_callback (Literal['local-pca'] | ~typing.Callable[[~typing.Literal['xy', 'x', 'y'], ~anndata._core.anndata.AnnData, ~anndata._core.anndata.AnnData | None], ~moscot.utils.tagged_array.TaggedArray | None] | None)

  • xy_callback_kwargs (Mapping[str, Any])

  • x_callback_kwargs (Mapping[str, Any])

  • y_callback_kwargs (Mapping[str, Any])

  • marginal_kwargs (Mapping[str, Any])

  • subset (Sequence[Tuple[K, K]] | None)

  • reference (Any | None)

Return type:

TranslationProblem[TypeVar(K, bound= Hashable)]

Returns:

: Returns self and updates the following fields: