Skip to content

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

@MaximilianNuber

Description

@MaximilianNuber

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions