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_dict
key in.obs
of 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_dict
as it does so. This reduces peak memory usage.- kwargs
Additional keyword arguments for concatenation.
- adata_dict
- Return type:
AnnData
- Returns:
A single
AnnData
object. The.obs
will contain a new column specifying the key of theAnnData
of origin.- Raises:
ValueError – If adata_dict is empty.
Warning
lower_peak_memory
defaults toFalse
. If lower_peak_memory is set toTrue
,adata_dict
will be deleted during the concatenation process.Notes
Memory is only freed if no other references to the
AnnData
objects inadata_dict
exist.