ncem.tl.differential_ncem

ncem.tl.differential_ncem(adata: anndata._core.anndata.AnnData, key_differential: str, key_graph: str, key_type: str, formula: str = '~0', type_specific_confounders: List[str] = [])[source]

Fit a differential NCEM based on an adata instance and save fits in instance.

Saves fits and Wald test output into instance.

Args:

adata: AnnData instance with data and annotation. formula: Description of batch covariates as linear model. Do not include intercept, cell type, niche, or the

differential term as this is automatically added.

key_differential: Key of condition annotation in .obs. This will be used for testing. key_graph: Key of spatial neighborhood graph in .obsp. key_type: Key of type annotation in .obs. type_specific_confounders: List of confounding terms in .obs to be added with an interaction term to cell

types, ie confounders that act on the cell type level. Global confounders can be added in the formula.

Returns: