smurf.get_finaldata_fast

smurf.get_finaldata_fast(cells_final, so, adatas_final, adata, weight_to_celltype, plot=True)

Quickly generates the final single-cell dataset by combining cell and spot data without using GPU resources.

This function provides a faster alternative to generate the final single-cell gene expression dataset, suitable for users who do not have access to GPU resources. It aggregates gene expression data from spots and assigns counts to individual cells based on optimized proportions. Optionally, it can plot the spatial distribution of cells on the tissue image.

Parameters:
  • cells_final (dict) – A dictionary mapping cell IDs to their final set of spots after expansion.

  • so (spatial_object) – A spatial object containing spatial mappings, spot data, and other necessary attributes.

  • adatas_final (anndata.AnnData) – An AnnData object containing the final single-cell gene expression data after processing.

  • adata (anndata.AnnData) – An AnnData object containing spatial gene expression data.

  • weight_to_celltype (numpy.ndarray) – A NumPy array where each row corresponds to a cell type and contains weight vectors used in the scoring function.

  • plot (bool, optional) – Whether to plot the cells on the spatial map after processing. Defaults to True. This may cost some time.

Returns:

An AnnData object containing the final single-cell gene expression data, along with cell metadata.

Return type:

anndata.AnnData