SOAPy_st.tl.cell_level_communications
- SOAPy_st.tl.cell_level_communications(adata: AnnData, lr_pairs: lr_pairs, species: Literal['ligand', 'receptor'] = 'ligand', agg_method: Literal['min', 'mean', 'gmean'] = 'gmean', scale: str | float = 'hires', sample: str | int | list | None = None, sample_key: str | None = None, contact_key: str = 'contact', contact_max_quantile: int = 95, secretory_key: str = 'secretory', secretory_radius: int | float = 100, fdr_axis: Literal['spot', 'lr'] = 'spot', pval_adj_cutoff: float = 0.05, adj_method: str = 'fdr_bh', norm: bool = True, percent_of_drop: int | float = 0, spatial_in_obsm: str = 'spatial', n_iters: int = 1000, inplace: bool = True) AnnData
A permutation test of ligand-receptor expression across every spot.
Parameters
- adataanndata.AnnData
An AnnData object containing spatial omics data and spatial information.
- lr_pairslr_pairs
database of ligand-receptor pairs.
- speciesLiteral[‘ligand’, ‘receptor’], optional
‘ligand’: The central cell is the ligand cell and the neighbor cells are the receptor cells. ‘receptor’: The central cell is the receptor cell and the neighbor cells are the ligand cells.
- agg_methodstr, optional
Integrated subunit to calculate ligand or receptor. ‘min’: ligand or receptor = min(sub1, sub2, sub3, …) ‘mean’: ligand or receptor = mean(sub1, sub2, sub3, …) ‘gmean’: geometrical mean, ligand or receptor = np.gmean(sub1, sub2, sub3, …)
- 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
- sampleUnion[str, int, list], optional
Samples for which communication scores need to be calculated
- sample_keystr, optional
The keyword of sample id in adata.obs.columns.
- contact_keystr, optional
The tag name that represents the contact type in the LR database
- contact_max_quantileint
In Neighbor network, Order the distance of all sides, and more than max_quantile% of the sides will be removed
- secretory_keystr, optional
The tag name that represents the secretory type in the LR database
- secretory_radiusUnion[int, float]
The maximum distance considered for the secretory type
- fdr_axisLiteral[‘spot’, ‘lr’]
Dimensions of applying multiple hypothesis testing ‘spot’: tested in each spot ‘lr’: tested in each ligand-receptor pair None: no multiple hypothesis testing
- pval_adj_cutofffloat
Cutoff for spot to be significant based on adjusted p-value.
- adj_methodstr
Any method supported by statsmodels.stats.multitest.multipletests; https://www.statsmodels.org/dev/generated/statsmodels.stats.multitest.multipletests.html
- normbool
Whether 0-1 normalization was performed on the expression volume data.
- percent_of_dropUnion[int, float]
Percentage of extreme values removed from normalization
- spatial_in_obsmstr
The key of spatial coordinates in adata.obsm
- n_itersint
Number of permutations for the permutation-test
- inplacebool, optional
Whether to change the original adata.
Returns
anndata.AnnData.uns['SOAPy']['ligand_spot_comm_score' or 'receptor_spot_comm_score']‘contact_names’: Names of used contact type lR pairs.
‘secretory_names’: Names of used secretory type lR pairs.
‘contact_affinity’: The affinity of contact type lR pairs.
‘secretory_affinity’: The affinity of secretory type lR pairs.