smurf.nuclei_rna

smurf.nuclei_rna(adata, so, min_percent=0.4)

Creates an AnnData object for nuclei by aggregating spot-level gene expression data.

This function processes spatial gene expression data to generate a nuclei-level AnnData object. It aggregates gene expression counts from spots corresponding to individual nuclei, based on spatial relationships and predefined mappings. It also filters spots based on a minimum percentage criterion for inclusion.

Parameters:
  • adata (anndata.AnnData) – An AnnData object containing spot-level gene expression data.

  • so (spatial_object) – A spatial_object containing image data, spot mappings, and spatial relationships.

  • min_percent (float, optional) – The minimum percentage of blank area within in a spot threshold for including neighboring spots in the cell aggregation. Spots with a blank proportion below this threshold will be excluded. Defaults to 0.4.

Returns:

The updated spatial_object so with a new attribute final_nuclei, which is an AnnData object containing nuclei-level gene expression data.

Return type:

spatial_object