deconvatac.tl.tangram

deconvatac.tl.tangram#

Functions#

tangram(adata_spatial, adata_ref, labels_key[, ...])

Run Tangram

Module Contents#

deconvatac.tl.tangram.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_spatialAnnData

AnnData of the spatial data.

adata_refAnnData

AnnData of the reference data.

labels_keystr

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.

devicestring 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.