deconvatac.tl.destvi
====================

.. py:module:: deconvatac.tl.destvi


Functions
---------

.. autoapisummary::

   deconvatac.tl.destvi.destvi


Module Contents
---------------

.. py:function:: destvi(adata_spatial, adata_ref, labels_key=None, layer_spatial=None, layer_ref=None, use_gpu=True, max_epochs_spatial=2000, max_epochs_ref=300, return_adatas=False, plots=True, results_path='./destvi_results', model_ref_kwargs={}, train_ref_kwargs={}, model_spatial_kwargs={}, train_spatial_kwargs={})

   Run DestVI

   Parameters 
   -----------

   adata_spatial : AnnData
       AnnData of the spatial data, filtered by highly variable features. Feature space needs to be the same as the one of adata_ref. 
   adata_ref : AnnData 
       AnnData of the reference data, filtered by highly variable features. Feature space needs to be the same as the one of adata_spatial.
   labels_key : str
       Cell type key in adata_ref.obs for label information
   layer_spatial : str
       Layer of adata_spatial to use for deconvolution. If None, uses adata_spatial.X.
   layer_ref : str
       Layer of adata_ref to use for deconvolution. If None, uses adata_ref.X.
   use_gpu : bool
       Whether to use the GPU.
   max_epochs_spatial: int
       Number of epochs for the stLVM.
   max_epochs_ref: int 
       Number of epochs for the scLVM. 
   return_adatas: bool 
       Whether to return AnnDatas with deconvolution results. Returns tupel: (adata_spatial, adata_ref).
   plots: bool 
       Whether to plot ELBO plots and UMAP of scLVM latent space.
   results_path: str
       Path to save estimated cell type abundances to. 
   model_ref_kwargs: dict
       Parameters for scvi.model.CondSCVI()
   train_ref_kwargs: dict
       Parameters for scvi.model.CondSCVI.train()
   model_spatial_kwargs: dict
       Parameters for scvi.model.DestVI.from_rna_model()
   train_spatial_kwargs: dict
       Parameters for scvi.model.DestVI.train()

       
   Returns
   --------

   - Saves estimated proportions as csv-file to results_path.
   - If return_adatas=True, returns tupel (adata_spatial, adata_ref) with saved deconvolution results. 


