scvi.data.transfer_anndata_setup

scvi.data.transfer_anndata_setup(adata_source, adata_target, extend_categories=False)[source]

Transfer anndata setup from a source object to a target object.

This handles encoding for categorical data and is useful in the case where an anndata object has been subsetted and a category is lost.

Parameters
adata_source : AnnData | dictUnion[AnnData, dict]

AnnData that has been setup with scvi. If dict, must be dictionary from source anndata containing scvi setup parameters.

adata_target : AnnDataAnnData

AnnData with equivalent organization as source, but possibly subsetted.

extend_categories : boolbool (default: False)

New categories in adata_target are added to the registry.