tasccoda.tree_ana.CompositionalAnalysisTree

class tasccoda.tree_ana.CompositionalAnalysisTree(data: anndata._core.anndata.AnnData, formula: str, reference_cell_type: Union[str, int] = 'automatic', reg: str = 'scaled_3', pen_args: dict = {'lambda': 5}, automatic_reference_absence_threshold: float = 0.05, *args, **kwargs)

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

Usage: model = CompositionalAnalysis(data, formula=”covariate1 + covariate2”, reference_cell_type=”CellTypeA”, pen_args={“phi”: 0})

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.

pen_args

Dictionary with penalty arguments. The parameters phi (aggregation bias), lambda_1, lambda_0 can be set here. See the tascCODA paper for an explanation of these parameters. Default: lambda_0 = 50, lambda_1 = 5, phi = 0.

Methods