ncem.tl.differential_ncem_deconvoluted

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

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

Saves fits and Wald test output into instance.

Args:

adata: AnnData instance with data and annotation. Note on placement of deconvolution output:

  • type abundances must in be in .obsm[key_deconvolution] with cell type names as columns

  • spot- and type-specific gene expression results must be layers named after types

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_deconvolution: Key of type deconvolution in .obsm. key_differential: Key of condition annotation in .obs. This will be used for testing. 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. As the formula is used for each index cell, this is equivalent to adding these terms into the formula.

Returns: