anndata.acc.MultiAcc#

class anndata.acc.MultiAcc(dim, k, *, ref_class)[source]#

Bases: RefAcc[R, int]

Reference accessor for arrays from multi-dimensional containers (A.obsm/A.varm).

Examples

>>> from anndata.acc import A, MultiAcc
>>> assert isinstance(A.obsm["pca"], MultiAcc)
>>> A.obsm["pca"][:, 0]
A.obsm['pca'][:, 0]

Attributes

dim: Literal['obs', 'var'][source]#

Axis this accessor refers to, e.g. A.obsm[k].dim == 'obs'.

k: str[source]#

Key this accessor refers to, e.g. A.varm['x'].k == 'x'.

ref_class: type[AdRef[Hashable]][source]#

Methods

dims(i, /)[source]#

Get along which dimensions the referenced array is.

Return type:

Collection[Literal['obs', 'var']]

get(adata, i, /)[source]#

Get the referenced array from the AnnData object.

Return type:

ndarray | MaskedArray | csr_matrix | csc_matrix | csr_array | csc_array | Array | ndarray | spmatrix

idx_repr(i)[source]#

Get a string representation of the index.

Return type:

str

isin(adata, idx=None)[source]#

Check if the referenced array is in the AnnData object.

Return type:

bool

static process_idx(i, /)[source]#