theislab / scCODA

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

Zero log2-fold change but credible change being identified? #66

Closed learning-MD closed 2 years ago

learning-MD commented 2 years ago

Thanks for this great tool, which has been very helpful in several projects! However, I've run into an issue that I'm not sure how to interpret. My understanding of the results interpretation was that we typically should expect a log2-fold change to be something other than 0 if there is a credible change in cluster composition: https://sccoda.readthedocs.io/en/latest/getting_started.html

However, when I run the following code, I see 0 for all log2-fold changes:

model_all = mod.CompositionalAnalysis(data_scanpy, formula="Cond", reference_cell_type="Platelets")
all_results = model_all.sample_hmc()
all_results.summary()

image

When checking credible changes, however, several populations are listed as TRUE:

print(all_results.credible_effects())

image

Is this expected behavior? Or is there an issue I'm missing? I'm not sure how to interpret these results. When I use "automatic" as my reference cell type (the "pDCs" group), only one cell population is described as having a credible change but still with a log2-fold change of 0. Visually, at least, that cluster appears to be smaller on a stacked barplot grouped by condition.

johannesostner commented 2 years ago

Hi @learning-MD ! This behaviour is unexpected, and your understanding of the results is correct. From your screenshots I am unable to figure out what the problem is here though.

Could you please add

Thank you!

learning-MD commented 2 years ago

As an update, I updated scCODA to the newest version (0.1.8) and this issue seems to be resolved. Both the log2-fold change and credible change results are consistent.

johannesostner commented 2 years ago

Thanks for the update! There was a bug in earlier versions of credible_effects (see #37), which was fixed in version 0.1.4, so this was likely the issue. Closing this for now.