moscot.problems.cross_modality.TranslationProblem.annotation_mapping¶
- TranslationProblem.annotation_mapping(mapping_mode, annotation_label, forward, source='src', target='tgt', batch_size=None, cell_transition_kwargs=mappingproxy({}), scale_by_marginals=True)¶
Transfer annotations between distributions.
This function transfers annotations (e.g. cell type labels) between distributions of cells.
- Parameters:
mapping_mode (
Literal['sum','max']) –How to decide which label to transfer. Valid options are:
'max'- pick the label of the annotated cell with the highest matching probability.'sum'- aggregate the annotated cells by label then pick the label with the highest total matching probability.
annotation_label (
str) – Key inobswhere the annotation is stored.forward (
bool) – IfTrue, transfer the annotations fromsourcetotarget.source (
TypeVar(K, bound=Hashable)) – Key identifying the source distribution.target (
TypeVar(K, bound=Hashable)) – Key identifying the target distribution.batch_size (
Optional[int]) – Number of rows/columns of the cost matrix to materialize duringpush()orpull(). Larger value will require more memory. IfNone, the entire cost matrix will be materialized.cell_transition_kwargs (
Mapping[str,Any]) – Keyword arguments forcell_transition(), used only ifmapping_mode = 'sum'.scale_by_marginals (
bool) – Whether to scale by the source/target marginals.
- Return type:
- Returns:
:
DataFrame- Returns the DataFrame of transferred annotations.