SONGDONGYUAN1994 / scDesign3

scDesign3 generates realistic in silico data for multimodal single-cell and spatial omics
https://songdongyuan1994.github.io/scDesign3/docs/index.html
MIT License
81 stars 23 forks source link

Question on setting batch effect strength #17

Open XiaPoppy opened 1 year ago

XiaPoppy commented 1 year ago

Hi Dongyuan,

in case I have 3 batches in total and I call the mean of the normalisation distribution 'strength':

num_batch <- 3
batch_strength <- 1
BATCH_marginal_alter <- lapply (BATCH_marginal, function(x) {
     lh <- length(x$fit$coefficients)
    x$fit$coefficients [ lh ] <- rnorm(1, mean = batch_strength, sd = 2)
    x$fit$coefficients [ lh-1 ] <- rnorm(1, mean = batch_strength+1, sd = 2)
    Х
})

Then I can separate all the 3 batches.

I am thinking about one thing now: Why don't we sample one value for a batch, and apply this value for all the features(genes) in this batch?

i.e.

batch_strength <- 1
co_1 <- rnorm(1, mean = batch_strength, sd = 2)
co_2 <- rnorm(1, mean = batch_strength + 1, sd = 2)
BATCH_marginal_alter <- lapply (BATCH_marginal, function(x) {
     lh <- length(x$fit$coefficients)
    x$fit$coefficients [ lh ] <- co_1
    x$fit$coefficients [ lh-1 ] <- co_2
    Х
})

Looking forward to your reply!

Best, Danyang

SONGDONGYUAN1994 commented 1 year ago

Hi Danyang, Short answer: I think people tend to believe that the batch effects are gene-specific. For example, see Combat-seq. You can check more literature or real data and decide whether it is reasonable (keep me posted if you find a conclusion, thanks!)

Best, Dongyuan