anndata.acc.MapAcc#

class anndata.acc.MapAcc[R: RefAcc, M: Mapping[str, object] | Mapping[str | None, object] = Mapping[str, object]](*, ref_acc_cls, scope=None)[source]#

Bases: ABC

Accessor for mapping containers.

Attributes

scope: ScopeAcc | None = None[source]#

Accessor for the element whose .AD cast the mapping is in, see anndata.acc.RefAcc.scope.

ref_acc_cls: type[R]#

Methods

abstractmethod __getitem__(k, /)[source]#

Get a reference accessor for mapped array.

Parameters:
k str

The key of the mapped array.

Return type:

R

container(data, /)[source]#

Get the AnnData object this accessor indexes into, see anndata.acc.RefAcc.container().

Return type:

AnnDataLikeMetadataOnly

get(data, /)[source]#

Get the referenced mapping from the AnnData object, e.g. adata.obsm for A.obsm.

Return type:

M

isin(data, /)[source]#

Check if the referenced mapping is in the AnnData object and has entries.

E.g. A.obsm.isin(adata) is True if adata.obsm isn’t empty. Returns False if scope isn’t in data or isn’t an AnnData object.

Return type:

bool