anndata.acc.LayerAcc#

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

Bases: RefAcc[R, Idx2D]

Reference accessor for arrays in layers (A.layers).

Examples

>>> from anndata.acc import A, LayerAcc
>>> assert isinstance(A.layers["counts"], LayerAcc)
>>> A.layers["counts"]["cell-1", :]
A.layers['counts']['cell-1', :]

Attributes

k: str | None[source]#

Key this accessor refers to, e.g. A.layers['counts'].k == 'counts'.

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

Methods

dims(idx, /)[source]#

Get along which dimensions the referenced array is.

Return type:

set[Literal['obs', 'var']]

get(adata, idx, /)[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(idx)[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