sccoda.util.comp_ana.CompositionalAnalysis

class sccoda.util.comp_ana.CompositionalAnalysis(data: anndata._core.anndata.AnnData, formula: str, reference_cell_type: Union[str, int] = 'automatic', automatic_reference_absence_threshold: float = 0.05)

Initializer class for scCODA models. This class is called when performing compositional analysis with scCODA.

Usage: model = CompositionalAnalysis(data, formula=”covariate1 + covariate2”, reference_cell_type=”CellTypeA”)

Calling an scCODA model requires these parameters:

data

anndata object with cell counts as data.X and covariates saved in data.obs

formula

patsy-style formula for building the covariate matrix. Categorical covariates are handled automatically, with the covariate value of the first sample being used as the reference category. To set a different level as the base category for a categorical covariate, use “C(<CovariateName>, Treatment(‘<ReferenceLevelName>’))”

reference_cell_type

Column index that sets the reference cell type. Can either reference the name of a column or a column number (starting at 0). If “automatic”, the cell type with the lowest dispersion in relative abundance that is present in at least 90% of samlpes will be chosen.

Methods