SOAPy_st.tl.neighborhood_analysis

SOAPy_st.tl.neighborhood_analysis(adata: AnnData, method: Literal['excluded', 'include'] = 'excluded', cluster_key: str = 'clusters', sample_key: str | None = None, sample: str | int | list | None = None, n_jobs: int | None = None, n_iters: int = 1000, inplace: bool = True) AnnData

Compute neighborhood enrichment Z-score by permutation test.

Parameters

adataanndata.AnnData

An AnnData object containing spatial omics data and spatial information.

methodstr, optional

‘included’: Z-scores of edges between two cell types were counted directly after randomization. ‘excluded’: After randomization, remove self-connected edges between cells of the same type and calculate the

z-score of edges between two cell types.

cluster_keystr, optional

The label of cluster in adata.obs.

sample_keystr, optional

The keyword of sample id in adata.obs.columns.

sample: Union[int, str, list, None],

The samples involved in calculating infiltration score.

n_jobsint, optional

The maximum number of concurrently running jobs.

n_itersint, optional

Number of rounds of random grouping for permutation tests.

inplacebool, optional

Whether to change the original adata.

Returns

  • anndata.AnnData.uns ['SOAPy']['include_method' or 'exclude_method']['dic_crd_poly'] - neighborhood score