liana.method.compute_global_specificity#
- liana.method.compute_global_specificity(adata, groupby, lr_sep='^', n_perms=1000, seed=1337, n_jobs=-1, verbose=False, use_raw=True, layer=None, uns_key='global_interactions')#
Computes group-specific ligand-receptor means and permutation-based p-values.
This function performs a one-sided permutation test to assess whether the observed group-specific means are significantly higher than expected by chance. P-values are computed using the formula (k + 1) / (n_perms + 1), where k is the number of permutations with values greater than or equal to the observed statistic.
- Parameters:
adata (
AnnData) – Annotated data object.groupby (
str) – Key to be used for grouping.lr_sep (
str|None(default:'^')) – Separator to use when joining ligand and receptor names into interactions.n_perms (
int(default:1000)) – Number of permutations for the permutation test. If None, no p-values are computed.seed (
int(default:1337)) – Random seed for reproducibility.n_jobs (
int(default:-1)) – Number of parallel jobs. Defaults to -1 (all available cores).verbose (
bool(default:False)) – Verbosity flag.use_raw (
bool(default:True)) – Use raw attribute of adata if present.layer (
str(default:None)) – Layer in anndata.AnnData.layers to use. If None, use anndata.AnnData.X.uns_key (
str(default:'global_interactions')) – Key inadata.unsthat contains the LIANA results. Default is'liana_res'.
- Return type:
- Returns:
None. The result with ‘lr_mean’ and ‘pval’ is stored in
adata.uns["global_interactions"].