AdataDict Class#
This module contains the AdataDict class, which is basically a nested dictionary of anndata, with a
few extra features to help restructure the nesting hierarchy and iterate over it. AdataDict inherits from dict and passes methods through to each AnnData in the AdataDict.
- class anndict.AdataDict(data=None, hierarchy=None)[source]#
AdataDictis a dictionary-like container where values areAnnDataobjects.AdataDictinherits fromdict.This class provides three main functionalities:
It has the
set_hierarchymethod to restructure the nesting hierarchy, and thehierarchyattribute to keep track.It behaves like an
AnnDataobject by passing methods through to eachAnnDatain the dictionary.It has methods
fapply(func, kwargs)andfapply_return(func, kwargs)that apply a given functionfuncwith argumentskwargsto eachAnnDataobject in theAdataDict.
- Parameters:
- data
dict[tuple[int,...],any] |None(default:None) Dictionary with keys as tuples of indices.
- hierarchy
tuple|list|None(default:None) Tuple or list indicating the order of indices in the keys of
data.
- data
Manipulate the hierarchy#
|
Rearrange the hierarchy of |
|
Split each value of an AnnData dictionary into further subsets based on additional desired strata. |
Flatten the hierarchy of |
See also
add_stratification()The function underneath
add_stratificationthat can be used to return a new object instead of modifying in place.
Iterate over AdataDict#
|
Applies |
|
Legacy wrapper for adata_dict_fapply. |
See also
adata_dict_fapply()The function underneath
fapplythat can be used separatley.
Index with a boolean mask#
|
Index the |
See also
adata_dict_fapply()Use this to generate a boolean mask of the correct format.
Set .obs and .var index#
|
Set the index of adata.obs to the specified column for each AnnData object in adata_dict. |
|
Set the index of |
Miscellaneous#
|
Check if an |
Copy the |