satijalab / sctransform

R package for modeling single cell UMI expression data using regularized negative binomial regression
GNU General Public License v3.0
203 stars 33 forks source link

batch_var is not corrected in sctransform::correct #125

Open dg520 opened 2 years ago

dg520 commented 2 years ago

Hi,

When I apply sctransform with batch_var = "Batch" and latent_var as default, the model becomes y ~ (log_umi) : Batch + Batch + 0 However, the correct function currently only sets latent_var (i.e. log_umi) to its median value without touching Batch. In this way, the corrected UMI seems to still contain the batch effect inside. I am wonder whether it makes sense to set Batch to the same level as well (e.g. for a Batch contains values of "A", "B" and "C", set all samples to "B") right before building regressor_data? Is this going to give me a corrected UMI matrix without Batch effect?

Thanks a lot!