cellcharter.gr.enrichment#
- cellcharter.gr.enrichment(adata, group_key, label_key, pvalues=False, n_perms=1000, log=True, observed_expected=False, copy=False)#
Compute the enrichment of
label_key
ingroup_key
.- Parameters:
adata (
AnnData
) – Annotated data object.group_key (
str
) – Key inanndata.AnnData.obs
where groups are stored.label_key (
str
) – Key inanndata.AnnData.obs
where labels are stored.pvalues (
bool
(default:False
)) – IfTrue
, compute empirical p-values by permutation. It will result in a slower computation.n_perms (
int
(default:1000
)) – Number of permutations to compute empirical p-values.log (
bool
(default:True
)) – IfTrue
use log2 fold change, otherwise use fold change.observed_expected (
bool
(default:False
)) – IfTrue
, return also the observed and expected proportions.copy (
bool
(default:False
)) – IfTrue
, return the result, otherwise save it to theadata
object.
- Return type:
- Returns:
- If
copy = True
, returns adict
with the following keys: 'enrichment'
- the enrichment values.'pvalue'
- the enrichment pvalues (ifpvalues is True
).'observed'
- the observed proportions (ifobserved_expected is True
).'expected'
- the expected proportions (ifobserved_expected is True
).
- Otherwise, modifies the
adata
with the following keys: anndata.AnnData.uns
['{group_key}_{label_key}_nhood_enrichment']
- the above mentioned dict.anndata.AnnData.uns
['{group_key}_{label_key}_nhood_enrichment']['params']
- the parameters used.
- If