ncem.tl.linear_ncem_deconvoluted

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

Fit a linear 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, or niche as

this is automatically added.

key_deconvolution: Key of type deconvolution in .obsm. 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: