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, **kwargs)[source]#
Prepare the translation problem.
See also
See Translating multiomics single-cell data on how to prepare the translation problem.
- Parameters:
src_attr (
Union
[str
,Mapping
[str
,Any
]]) –How to get the data for the source modality:
dict
- it should contain'attr'
and'key'
, the attribute and the key inAnnData
, and optionally'tag'
, one ofTag
.
By default,
tag = 'point_cloud'
is used.tgt_attr (
Union
[str
,Mapping
[str
,Any
]]) –How to get the data for the target modality:
dict
- it should contain'attr'
and'key'
, the attribute and the key inAnnData
, and optionally'tag'
, one ofTag
.
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:
None
- the pure Gromov-Wasserstein case is used.dict
- it should contain'attr'
and'key'
, the attribute and key inAnnData
, and optionally'tag'
from thetags
.
By default,
tag = 'point_cloud'
is used.batch_key (
Optional
[str
]) – Key inobs
specifying the batch.cost (
Union
[Literal
['euclidean'
,'sq_euclidean'
,'cosine'
,'pnorm_p'
,'sq_pnorm'
,'elastic_l1'
,'elastic_l2'
,'elastic_stvs'
,'elastic_sqk_overlap'
],Mapping
[Literal
['xy'
,'x'
,'y'
],Literal
['euclidean'
,'sq_euclidean'
,'cosine'
,'pnorm_p'
,'sq_pnorm'
,'elastic_l1'
,'elastic_l2'
,'elastic_stvs'
,'elastic_sqk_overlap'
]]]) –Cost function to use. Valid options are:
str
- name of the cost function for all terms, seeget_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 theBaseCost
or any backend-specific cost.Source marginals. Valid options are:
Target marginals. Valid options are:
- Return type:
TranslationProblem
[TypeVar
(K
, bound=Hashable
)]- Returns:
: Returns self and updates the following fields: