SOAPy_st.tl.spatial_tendency

SOAPy_st.tl.spatial_tendency(adata: AnnData, mask: ndarray, radius: int, method: Literal['poly', 'loess'] = 'poly', gene_name: str | list = 'all', clusters: str | int | list = 'all', cluster_key: str | None = None, location: Literal['all', 'in', 'out'] = 'all', scale: float | str = 'hires', spatial_in_obsm: str = 'spatial', frac: int | float | None = None, sd: int | None = None, drop_zero: bool = False, inplace: bool = True) AnnData

We used two regression methods, Loess regression, and Polynomial regression, to study the variation of the expression with the min distance from its location to the pixel of boundary.

Parameters

adataanndata.AnnData

An AnnData object containing spatial omics data and spatial information.

masknumpy.ndarray

Binarized image data of ROI.

radiusfloat

The range of the point whose included in the calculation.

methodLiteral[‘poly’, ‘loess’], optional

Polynomial regression(poly) or Loess regression(loess).

gene_nameUnion[list, str, None], optional

The gene names for the regression model need to be calculated.

clustersUnion[str, int, list], optional

The cluster of the spot being counted, the default is all clusters.

cluster_keyUnion[str, int, list], optional

The key of cluster in adata.obs.

locationstr, optional

‘in’: The selected spots inside the contours. ‘out’: The selected spots outside the contours. ‘all’: both of ‘in’ and ‘out’.

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

fracUnion[int, float], optional

The highest degree of a polynomial regression or lowess regression smoothness.

sdint, optional

The coefficient of the standard deviation of the tail treatment.

drop_zerobool, optional

Whether to remove all spots with 0 expression

inplacebool, optional

Whether to change the original adata.

Returns

  • anndata.AnnData.uns ['SOAPy']['poly']['dic_crd_poly'] or ['SOAPy']['loess']['dic_crd_loess'] - Store

    the shape of curves

  • anndata.AnnData.uns ['SOAPy']['poly']['df_param_poly'] or ['SOAPy']['loess']['df_param_loess'] - Store

    additional params for curves