cellcharter.gr.diff_nhood_enrichment#
- cellcharter.gr.diff_nhood_enrichment(adata, cluster_key, condition_key, condition_groups=None, connectivity_key=None, pvalues=False, library_key='library_id', n_perms=1000, n_jobs=None, copy=False, **nhood_kwargs)#
Differential neighborhood enrichment between conditions.
- Parameters:
adata (
AnnData) – Annotated data object.cluster_key (
str) – Key inanndata.AnnData.obswhere clustering is stored.condition_key (
str) – Key inanndata.AnnData.obswhere the sample condition is stored.condition_groups (
Optional[tuple[str,str]] (default:None)) – The condition groups to compare. IfNone, all conditions incondition_keywill be used.connectivity_key (
Optional[str] (default:None)) – Key inanndata.AnnData.obspwhere spatial connectivities are stored. Default is:anndata.AnnData.obsp['spatial_connectivities'].pvalues (
bool(default:False)) – IfTrue, compute the p-values for each differential neighborhood enrichment through permutation of the condition key for each Z-dimension.library_key (
str|None(default:'library_id')) – If multiple library_id, column in anndata.AnnData.obs which stores mapping between library_id and obs. Used only ifpvaluesisTrueto permute the condition labels.n_perms (
int(default:1000)) – Number of permutations to use to compute the expected neighborhood enrichment ifpvaluesisTrue.n_jobs (
Optional[int] (default:None)) – Number of jobs to run in parallel ifpvaluesisTrue.-1means using all processors.copy (
bool(default:False)) – IfTrue, return the result, otherwise save it to theadataobject.nhood_kwargs –
- Keyword arguments for
gr.nhood_enrichment(). The following arguments are not allowed: n_permspvaluesn_jobs
- Keyword arguments for
- Return type:
- Returns:
If
copy = True, returns adictof all pairwise differential neighborhood enrichments between conditions stored as{condition1}_{condition2}. The differential neighborhood enrichment is adictwith the following keys:'enrichment'- the differential neighborhood enrichment.'pvalue'- the enrichment pvalues (ifpvaluesisTrue).