deconvatac.tl.tangram
=====================

.. py:module:: deconvatac.tl.tangram


Functions
---------

.. autoapisummary::

   deconvatac.tl.tangram.tangram


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

.. py:function:: tangram(adata_spatial, adata_ref, labels_key, run_rank_genes=False, layer_rank_genes=None, num_epochs=1000, device='cpu', return_adatas=False, result_path='./tangram_results', **kwargs)

   Run Tangram

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

   adata_spatial : AnnData
       AnnData of the spatial data.
   adata_ref : AnnData
       AnnData of the reference data.
   labels_key : str
       Cell type key in adata_ref.obs for label information
   run_rank_genes: bool
       If true, will run sc.tl.rank_genes_groups on reference anndata followed by tg.pp_adatas.
       If false, will only run tg.pp_adatas with all peaks of the input anndatas. Thus, expects anndatas to be already filtered by HVFs.
   layer_rank_genes: str
       Only if run_rank_genes is true. Layer to use for sc.tl.rank_genes_groups.
   num_epochs: int
       Number of epochs.
   device : string or torch.device
       Which device to use.
   return_adatas: bool
       Whether to return AnnDatas with deconvolution results. Returns tupel: (adata_spatial, adata_ref).
   results_path: str
       Path to save estimated cell type abundances to.
   **kwargs:
       Parameters for tangram.mapping_utils.map_cells_to_space()

   Returns
   --------

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


