DavisLaboratory / standR

Spatial transcriptomics analyses and decoding in R
https://davislaboratory.github.io/standR/
Other
15 stars 3 forks source link

Differential expression analysis with limma-voom pipeline #34

Open orange-3711 opened 3 weeks ago

orange-3711 commented 3 weeks ago

Hi @ningbioinfo ! Do the variables used to model.matrix for differential gene analysis need to be consistent with the variables of interest in batch effect removal? I used inconsistent variables and the results were not very good. I hope you can answer my questions, thank you.

ningbioinfo commented 3 weeks ago

Hi @orange-3711 . In the documentation of the function:

design A design matrix relating to treatment conditions to be preserved, can be generated using stats::model.matrix function with all biological factors included.

So, say you're using model.matrix(~0 + bio_var1 + bio_var2, data = colData(spe)) in the geomxBatchCorrection function with the method = "limma" and batch = colData(spe)$batch. And you're happy with the normalization output by verified in PCA & RLE.

Then, your should use the raw count in your DGElist when doing DE, and your design would be model.matrix(~0 + bio_var1 + bio_var2 + batch, data = colData(spe))

So, besides the addition of the batch variable, other covariates should be consistent.