anndata.acc.RefAcc#

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

Bases: ABC

Abstract base class for reference accessors.

See reference accessors for all existing subclasses.

Attributes

ref_class: type[AdRef[Hashable, MuData | AnnData]][source]#

Methods

abstractmethod __repr__()[source]#

Get a string representation of the accessor.

Return type:

str

abstractmethod dims(idx, /)[source]#

Get along which dimensions the referenced array is.

Return type:

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

abstractmethod get(data, idx=NO_IDX, /)[source]#
Overloads:
  • self, data (D) → FullArray

  • self, data (D), idx (I) → Array

Get the indexed array from the AnnData object at idx.

When idx is omitted (i.e., idx is NO_IDX), return the full array one level up instead. This has the same semantics as the AdRef path but one level up: adata[A.obs] returns the full DataFrame and adata[A.obsm["pca"]] the full numpy.ndarray. These both have defined shape-like properties (or awkward.Array), unlike, for example, obsm or similar.

abstractmethod idx_repr(idx, /)[source]#

Get a string representation of the index.

Return type:

str

abstractmethod isin(data, idx=None, /)[source]#

Check if the referenced array is in the AnnData object.

Return type:

bool

process_idx(idx, /)[source]#
Return type:

TypeVar(I)