tangram.utils.project_cell_annotations

tangram.utils.project_cell_annotations(adata_map, adata_sp, annotation='cell_type', threshold=0.5)

Transfer annotation from single cell data onto space.

Parameters
  • adata_map (AnnData) – cell-by-spot AnnData returned by train function.

  • adata_sp (AnnData) – spatial data used to save the mapping result.

  • annotation (str) – Optional. Cell annotations matrix with shape (number_cells, number_annotations). Default is ‘cell_type’.

  • threshold (float) – Optional. Valid for using with adata_map.obs[‘F_out’] from ‘constrained’ mode mapping. Cell’s probability below this threshold will be dropped. Default is 0.5.

Returns

None. Update spatial Anndata by creating obsm tangram_ct_pred field with a dataframe with spatial prediction for each annotation (number_spots, number_annotations)