Search
Question: Scater normalizeExprs() batch effect
0
16 months ago by
Jenn20
Jenn20 wrote:

I have a question about how to write the design matrix for normalizeExprs(). Do I include only the uninteresting variables/factors that I wanted to control for in the design matrix or should I also include the condition that I am interested in seeing the effect?

design=model.matrix(~batch)

example_sceset <- normaliseExprs(example_sceset, design=design)

or

design=model.matrix(~batch+condition)

example_sceset <- normaliseExprs(example_sceset, design=design)

This is the detail from the scater manual

design: design matrix defining the linear model to be fitted to the normalised expression values. If not NULL, then the residuals of this linear model fit are used as the normalised expression values.

Thanks!

modified 16 months ago by Aaron Lun21k • written 16 months ago by Jenn20
1
16 months ago by
Aaron Lun21k
Cambridge, United Kingdom
Aaron Lun21k wrote:

Anything in the design matrix gets regressed out (as residuals are returned), so you don't want to put in features of interest. If you want more control, you can apply removeBatchEffect (from the limma package) on the expression matrix yourself, to define which variables to keep and which variables to remove.