sccoda.model.scCODA_model.scCODAModel

class sccoda.model.scCODA_model.scCODAModel(reference_cell_type, *args, **kwargs)

Statistical model for single-cell differential composition analysis with specification of a reference cell type. This is the standard scCODA model and recommenced for all uses.

The hierarchical formulation of the model for one sample is:

\[\begin{split}y|x &\sim DirMult(\phi, \bar{y}) \\ \log(\phi) &= \alpha + x \beta \\ \alpha_k &\sim N(0, 5) \quad &\forall k \in [K] \\ \beta_{m, \hat{k}} &= 0 &\forall m \in [M]\\ \beta_{m, k} &= \tau_{m, k} \tilde{\beta}_{m, k} \quad &\forall m \in [M], k \in \{[K] \smallsetminus \hat{k}\} \\ \tau_{m, k} &= \frac{\exp(t_{m, k})}{1+ \exp(t_{m, k})} \quad &\forall m \in [M], k \in \{[K] \smallsetminus \hat{k}\} \\ \frac{t_{m, k}}{50} &\sim N(0, 1) \quad &\forall m \in [M], k \in \{[K] \smallsetminus \hat{k}\} \\ \tilde{\beta}_{m, k} &= \sigma_m^2 \cdot \gamma_{m, k} \quad &\forall m \in [M], k \in \{[K] \smallsetminus \hat{k}\} \\ \sigma_m^2 &\sim HC(0, 1) \quad &\forall m \in [M] \\ \gamma_{m, k} &\sim N(0,1) \quad &\forall m \in [M], k \in \{[K] \smallsetminus \hat{k}\} \\\end{split}\]

with y being the cell counts and x the covariates.

For further information, see scCODA: A Bayesian model for compositional single-cell data analysis (Büttner, Ostner et al., 2020)

Methods

get_chains_after_burnin(samples, …[, is_nuts])

Application of burn-in after MCMC sampling.

get_y_hat(states_burnin, num_results, num_burnin)

Calculate posterior mode of cell counts (for analysis purposes) and add intermediate parameters that are no priors to MCMC results.

make_result(states_burnin, sample_stats, …)

Result object generating function.

sample_hmc([num_results, num_burnin, …])

Hamiltonian Monte Carlo (HMC) sampling in tensorflow 2.

sample_hmc_da([num_results, num_burnin, …])

HMC sampling with dual-averaging step size adaptation (Nesterov, 2009)

sample_nuts([num_results, num_burnin, …])

HMC with No-U-turn (NUTS) sampling.

sampling(num_results, num_burnin, kernel, …)

MCMC sampling process (tensorflow 2)