How to specify batch correction for 7 samples from two bacthes?


We have 7 scRNAseq samples, which come from 2 experiments(1 experiment : 1 rep of WT and 2 reps KO samples and another experiment 2 reps of WT and 2 reps of KO samples). The batch effect can be there due to the sample info as well as the batch. How to remove both these sources of batch effects? Should it be done sequentially or can this be specified in one run? If sequentially should we remove the experiment effect and then sample effect?

looking forward to hearing from you


I am still looking forward to getting the answer for this quesiton.

Hi, thank you for your question. If you would like to use SCVI to correct for both sources of batch effects, you can pass in one as the batch_key and the other as categorical_covariate_keys in setup_anndata. The model’s latent space will then be integrated with respect to both sources of technical variation.

If instead you would like to sequentially remove the two sources, I would recommend giving MrVI a try. It provides a latent space corrected for only batch-level effects (the experiment in your case) and another latent space corrected for both batch-level and sample-level effects.