anndict.adata_dict.concatenate_adata_dict#
- anndict.adata_dict.concatenate_adata_dict(adata_dict, *, new_col_name=None, lower_peak_memory=False, **kwargs)[source]#
Concatenate all AnnData objects in adata_dict into a single AnnData object. If only a single AnnData object is present, return it as is.
- Parameters:
- adata_dict
AdataDict AdataDict- new_col_name
str|None(default:None) If provided, the name of the new column that will store the
adata_dictkey in.obsof the concatenated AnnData. Defaults toNone.- lower_peak_memory
bool(default:False) If True, the the function concatenates the AnnData objects in adata_dict sequentially, and deletes the data from
adata_dictas it does so. This reduces peak memory usage.- kwargs
Additional keyword arguments for concatenation.
- adata_dict
- Return type:
AnnData- Returns:
A single
AnnDataobject. The.obswill contain a new column specifying the key of theAnnDataof origin.- Raises:
ValueError – If adata_dict is empty.
Warning
lower_peak_memorydefaults toFalse. If lower_peak_memory is set toTrue,adata_dictwill be deleted during the concatenation process.Notes
Memory is only freed if no other references to the
AnnDataobjects inadata_dictexist.