SOAPy_st.tl.domain_from_local_moran

SOAPy_st.tl.domain_from_local_moran(adata: AnnData, score_key: str, moran_label_key: str = 'hotspot', k: int = 6, pvalue_filter: float = 0.05, attribute_filter: float | None = None, spatial_lag_filter: float | None = None, zscore: bool = True, fdr: bool = True, scale: str | float = 'hires', spatial_in_obsm: str = 'spatial', inplace: bool = True) AnnData

Using the local moran method generate the spatial domain.

Parameters

adataanndata.AnnData

An AnnData object containing spatial omics data and spatial information.

score_keystr

The key for the Moran index need to be computed. It could be gene name ,key in adata.obs_index or AUCell name.

moran_label_keystr

The key for storing Moran labels in adata.obs.

kint, optional

Number of nearest neighbors in KNN.

pvalue_filterfloat, optional

Threshold for determining hotspot regions based on the p-value of the local Moran’s I statistic. A smaller value indicates higher statistical significance, typically set to 0.05 or another significance level. For a detailed explanation, see https://pysal.org/esda/generated/esda.Moran_Local.html#esda.Moran_Local

attribute_filterfloat, optional

Threshold for attribute filtering (AUCell score). If provided, it affects how observations are labeled as “Hotspot” or “Not” based on whether the attribute value is greater than or equal to this threshold. For a detailed explanation, see https://pysal.org/esda/generated/esda.Moran_Local.html#esda.Moran_Local

spatial_lag_filterfloat, optional

Threshold for the average attribute of neighboring spots. If provided, it affects how observations are labeled as “Hotspot” or “Not” based on whether the spatial lag value of the local Moran’s I statistic is greater than or equal to this threshold.

zscorebool, optional

If True, calculate the z-score of the attribute.

fdrbool, optional

If True, the p-values were corrected for FDR.

scaleUnion[str, float], optional

scale used in subsequent analyses. If it’s Visium data it can also be HE image labels (hires or lower). Most of the time you don’t need to change this.

spatial_in_obsmstr, optional

The key of spatial coordinates in adata.obsm.

inplacebool, optional

If True, Modify directly in the original adata.

Returns

  • anndata.AnnData.uns ['SOAPy']['local_moran'] - Local Moran information for each spot