SOAPy_st.tl.wilcoxon_test

SOAPy_st.tl.wilcoxon_test(adata: AnnData, mask: ndarray, radius: float, gene_name: list | str | None = None, clusters: str | int | list = 'all', cluster_label: str | None = None, location: Literal['all', 'in', 'out'] = 'all', scale: float | str = 'hires', spatial_in_obsm: str = 'spatial', alternative: str = 'two-sided', ran: float | None = None, cut: float | None = 0, alpha: float = 0.05, drop_zero: bool = False, inplace: bool = True) DataFrame

Wilcoxon tests were performed using the distance from each spot(cell) to the mask boundary and the expression of a gene(protein) at each spot.

Parameters

adataanndata.AnnData

An AnnData object containing spatial omics data and spatial information.

masknumpy.ndarray

A binarized image data of ROI.

radiusfloat

Maximum distance considered, negative distance by absolute value.

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_labelstr, optional

The label of cluster in adata.obs.

locationLiteral[‘all’, ‘in’, ‘out’]

‘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

alternative: {‘two-sided’, ‘less’, ‘greater’}, optional

Defines the alternative hypothesis. Default is ‘two-sided’. For more details, see scipy.stats.mannwhitneyu()

ranfloat, optional

Minimum range, genes are ignored when their range is smaller than this value.

cutfloat, optional

Distance threshold for grouping. The default value is 0, which represents the two groups inside and outside the contour.

alphafloat, optional

Family-wise error rate of P-fdr. Defaults to 0.05.

drop_zerobool, optional

Whether to remove all spots with 0 expression.

inplacebool, optional

Whether to change the original adata.

Returns

pandas.DataFrame

The wilcoxon-test result is stored, including the p-value(‘P value’), the fdr p-value(‘P fdr’), and the label of whether the p-value is significant or not(‘P rej’).