theislab / scCODA

A Bayesian model for compositional single-cell data analysis
BSD 3-Clause "New" or "Revised" License
152 stars 24 forks source link

Intra-sample abundances #99

Open n-hal opened 4 months ago

n-hal commented 4 months ago

Hi. Great package!

Had a question regarding performing intra-sample abundance comparisons. Do you think this is feasible/appropriate to use scCODA for?

I.e. You have a covariate that doesn't describe the entire sample population. To give an example to avoid confusion, if one wanted to measure cell-type abundance, and each cell is described by another covariate (Cov1: which takes the values A&B). Could one appropriately split the samples into Sample_1_A & Sample_1_B, and measure differential abundance with a formula Cov1 + Sample? Would you have any suggestion how to do this otherwise? I should mention that Cov1 is also the covariate of interest.

Thanks

johannesostner commented 4 months ago

Hi @n-hal,

thanks for the kind words!

If I understand you correctly, you have cells from condition A and B in each of your samples (or for some samples only cells from one condition, doesn't matter). As you described correctly, you should then split your data into Sample_1_A, Sample_1_B, Sample_2_A,... The "samples" in scCODA refer to the statistical definition of a sample, which are not always necessarily the same as your biological samples. As for the formula, this depends on your research question. If you are only interested in the difference between conditions A and B, then you should only include Cov1 in your formula. Just like in a regression model, you can also test for differential abundance of multiple conditions at once.