# Differential expression between datasets

**URL:** <https://discourse.scverse.org/t/differential-expression-between-datasets/85>\
**Category:** scvi-tools\
**Tags:** diff-exp\
**Created:** [May 7, 2021, 12:38pm UTC](https://discourse.scverse.org/t/differential-expression-between-datasets/85 "2021-05-07T12:38:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![grst](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/grst/32/17_2.png) [@grst](https://discourse.scverse.org/u/grst)\
**Post date:** [May 7, 2021, 12:38pm UTC](https://discourse.scverse.org/t/differential-expression-between-datasets/85/1 "2021-05-07T12:38:51Z")

</div>

Hi all,

I was wondering if scVI’s differential expression module still works in the following case:

I integrated two datasets with scANVI:

- dataset1: healthy lung tissue, mixture of immune, stromal, endothelial and epithelial cells, 10x
- dataset2: lung cancer tissue, also a mixture of the same cell types, Smart-seq2

Judging from the UMAP plot, the integration worked reasonably well.

I would like to compare for each cell type healthy vs. tumor samples.

With any classical DE method (i.e. a linear model), I’d expect the results of this comparison  
to mainly reflect the technical differences between the 10x and the Smart-seq2 platforms. Since scANVI appears to successfully reduce the batch effects in the latent representation, I was wondering if such comparisons between datasets from different platforms become feasible as well.

Best regards,  
Gregor

---

<div class="post-metadata">

**Author:** ![Valentine\_Svensson](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/valentine_svensson/32/10_2.png) [@Valentine\_Svensson](https://discourse.scverse.org/u/Valentine_Svensson)\
**Post date:** [May 7, 2021, 5:15pm UTC](https://discourse.scverse.org/t/differential-expression-between-datasets/85/2 "2021-05-07T17:15:44Z")

</div>

As you suspect, you will have the same issues as a linear model of not being able to know whether the fold changes you find are due technical differences or disease status.

To do this kind of differential expression, where you have confounding between data source and condition, the easiest solution is to find more data sources. Then you can treat each data source as a replicate.

If you have three independent healthy lung data sets and three independent lung cancer data sets, you can integrate these to harmonize the cell type annotations, then do within-cell-type differential expression between cancer vs healthy across the six total data sets.

---

<div class="post-metadata">

**Author:** ![grst](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/grst/32/17_2.png) [@grst](https://discourse.scverse.org/u/grst)\
**Post date:** [May 10, 2021, 8:59am UTC](https://discourse.scverse.org/t/differential-expression-between-datasets/85/3 "2021-05-10T08:59:20Z")

</div>

Hi Valentine,

thanks for your quick reply and for your suggestion!  
To make sure I got it right: By “treating the datasets as replicates” you mean

- integrating them using scVI while specifying dataset as batch variable and then
- simply use the `SCVI.differential_expression()` for the comparison?

Or are you rather referring to “pseudo-bulk” comparisons, such that every dataset becomes a sample?

Best,  
Gregor

---

<div class="post-metadata">

**Author:** ![Valentine\_Svensson](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/valentine_svensson/32/10_2.png) [@Valentine\_Svensson](https://discourse.scverse.org/u/Valentine_Svensson)\
**Post date:** [May 20, 2021, 5:39am UTC](https://discourse.scverse.org/t/differential-expression-between-datasets/85/4 "2021-05-20T05:39:07Z")

</div>

At the moment scVI can’t deal with hierarchical samples (I think?). I use generalized linear mixed models, but pseudo-bulk should also work. You can split the total data by the (harmonized) cell type annotation and data-set.

---

<div class="post-metadata">

**Author:** ![grst](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/grst/32/17_2.png) [@grst](https://discourse.scverse.org/u/grst)\
**Post date:** [May 20, 2021, 7:25am UTC](https://discourse.scverse.org/t/differential-expression-between-datasets/85/5 "2021-05-20T07:25:37Z")

</div>

Thanks!

For future reference: I found [this article](https://www.nature.com/articles/s41467-021-21038-1) really helpful in explaining the point of using mixed effects models for single-cell DE analyses.
