anndata.acc.MultiAcc#
- class anndata.acc.MultiAcc[R: AdRef[int, AnnDataLikeMetadataOnly]](dim, k, *, ref_class, scope=None)[source]#
Bases:
RefAcc[R,int,AnnDataLikeMetadataOnly,AlignedArray,InMemoryArray|ExtensionArray|Variable]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]
Note that something like this is invalid, as it references an array that isn’t aligned to an anndata dimension.
A.varm["PCs"]["cell-0", :]
Attributes
- property DF: DFAcc[R][source]#
Treat the array as a data frame, to refer to its columns by name, e.g.
A.obsm['x'].DF['c'].
- scope: ScopeAcc | None = None#
Accessor for the element whose
.ADcast this accessor is in, e.g.A.uns['a']forA.uns['a'].AD.obsm['x'].DF.If
None, this accessor refers into the object passed toget()/set()/isin()itself.
Methods
- dims(i, /)[source]#
Get along which dimensions the referenced array is.
- Return type:
Collection[Literal['obs','var']]
- get(data, i=NO_IDX, /)[source]#
Get the indexed array or element from the AnnData object at
idx.- Overloads:
data (
AnnDataLikeMetadataOnly), / →AlignedArraydata (
AnnDataLikeMetadataOnly), i (int), / →InMemoryArray
When
idxis omitted (i.e.,idxisNO_IDX), return the full array one level up instead. This has the same semantics as theAdRefpath but one level up:adata[A.obs]returns the fullDataFrame,adata[A.obsm["pca"]]the fullnumpy.ndarray, andadata[A.layers]the fullMapping. The first two both have definedshape-like properties (orawkward.Array), butlayersor similar do not.
- isin(data, idx=None)[source]#
Check if the referenced array is in the AnnData object.
Returns
Falseifscope(orframe_acc) isn’t indataor doesn’t have the type this accessor casts it to (.AD/.DF).The base implementation only checks
scope. Subclasses should returnFalseifsuper().isin(data, idx)does, socontainer()won’t fail afterwards.- Return type: