Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"use_observed_batches" in "model.differential_expression depends on batch_correction #4

Open
MaximilianNuber opened this issue Feb 2, 2024 · 0 comments

Comments

@MaximilianNuber
Copy link

Dear all, dear Dr. Boyeau,

Thank you for the great toolkit, it is exactly what I need to analyse my data.
I have been interested in the lvm-de, as it not only uses the scvi models I already trained, but believe that the bayesian approach with optional permutation is perfect for the heterogeneity of my data.

Specifically, I am looking to compare the expression of two groups within a cell type, a scenario covered in the respective publication.
As I have several patients per group, I typically use the batch_correction option.

However, I tried to use use_observed = True for conditioning the expression per cell on the respective batch/sample, so I would get a sample-based comparison of expression values.
This gave me the error:
TypeError: scvi.model.base._differential.DifferentialComputation.get_bayes_factors() got multiple values for keyword argument 'use_observed_batches'

Digging a bit into the source code, I found that in scvi-tools / scvi / model / base / _utils.py
the _de_core function calls DifferentialComputation.get_bayes_factors (line 250).
In this function call, the option is set as use_observed_batches=not batch_correction .

So to my understanding, if I understand correctl, whenever batch_correction is True, I cannot condition on batches, and th other way around.

This does seem deliberate, so my question is how batch_correction and conditioning on batches relate to each other?
Why does one exclude the other, or is even the opposite of the other?
Is there a way to not condition on batch, and not batch_correct at the same time?

I am trying to get the background, as I am relatively new to the field and will publish the results, for which I like to have at least a most basic understanding.

Thank you for any help.
Best,
Max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant