Accessors and paths#
anndata.acc creates references to 1D and 2D arrays in an AnnData object.
You can use these to drive e.g. plotting or validation code.
For these purposes, they
are easy to create:
The central
Aobject allows you to createAdRefobjects that reference arrays along one or two dimensions of ananndata.AnnDataobject:>>> from anndata.acc import A >>> A[:, "gene-3"] # reference to `adata[:, 3].X` as 1D vector A[:, 'gene-3'] >>> type(A[:, "gene-3"]) <class 'anndata.acc.AdRef'>
introspectible
AdRefs have theAdRef.dims,AdRef.idx, andAdRef.accattributes, allowing you to inspect all relevant properties.>>> pc0 = A.obsm["pca"][:, 0] >>> pc0 # reference to the 0th column of `adata.obsm['pca']` A.obsm['pca'][:, 0] >>> pc0.idx 0 >>> pc0.acc A.obsm['pca'] >>> A.var["symbol"].dims {'var'} >>> pc0.acc.k 'pca'
convenient
Want to reference multiple vectors from the same object? Pass a list of indices to the vector accessor:
>>> A.obsp["connectivities"][:, ["cell0", "cell1"]] [A.obsp['connectivities'][:, 'cell0'], A.obsp['connectivities'][:, 'cell1']]
extensible (see extending accessors)
API#
The central starting point is A:
See AdAcc for examples of how to use it:
|
|
|
A reference to a 1D or 2D array along one or two dimensions of an AnnData object. |
The following classes are behind AdRef.acc,
and therefore useful in matches or isinstance() checks:
|
Abstract base class for reference accessors. |
MetaAccwithMetaAcc.dimLayerAccwithLayerAcc.kMultiAccwithMultiAcc.dimandMultiAcc.kGraphAccwithGraphAcc.dimandGraphAcc.k
Finally, these classes are only useful for extending:
|
Accessor for mapping containers. |
|
Accessor for layers ( |
|
Accessor for multi-dimensional array containers ( |
|
Extending accessors#
Attention
TODO