SOAPy_st.tl.cell_type_level_communication
- SOAPy_st.tl.cell_type_level_communication(adata: AnnData, lr_pairs: lr_pairs, cluster_key: str = 'cluster', agg_method: str = 'gmean', scale: str | float = 'hires', sample: str | int | list | None = None, sample_key: str | None = None, affinity_cutoff: float | None = 0.05, strength_cutoff: float | None = 2.0, contact_key: str | None = 'contact', contact_max_quantile: int = 95, secretory_key: str | None = 'secretory', secretory_radius: int | float = 100, k: str | float = 1, m: str | float = 1, norm: bool = True, percent_of_drop: int | float = 0, spatial_in_obsm: str = 'spatial', n_iters: int = 1000, inplace: bool = True) AnnData
Cell type ligand-receptor algorithm composed of two indexes: affinity and strength. The affinity is calculated from the p-value of the permutation-test. The strength is a combination score of the ratio of the expression and the number of edges to the expectation.
Parameters
- adataanndata.Anndata
An AnnData object containing spatial omics data and spatial information.
- lr_pairslr_pairs
database of ligand-receptor pairs
- cluster_keystr
The label of cluster in adata.obs.
- agg_methodstr
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]
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.
- affinity_cutofffloat
The cutoff of affinity.
- strength_cutoffOptional[float]
The cutoff of strength.
- 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
- k: Union[str, float]
The weight of the expression function
- m: Union[str, float]
The weight of the edge function
- 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']‘celltype’: cell type in used sample.
- ‘contact’: cell-cell communication between cell types under contact type LR.
‘names’: Names of used contact type lR pairs.
‘sig_celltype’: How cell types communicate with each other under contact conditions.
‘strength’: The strength of contact type lR pairs.
‘affinity’: The affinity of contact type lR pairs.
- ‘secretory’: cell-cell communication between cell types under secretory type LR.
‘names’: Names of used secretory type lR pairs.
‘sig_celltype’: How cell types communicate with each other under secretory conditions.
‘strength’: The strength of secretory type lR pairs.
‘affinity’: The affinity of secretory type lR pairs.