Scater normalizeExprs() batch effect
1
0
Entering edit mode
Jenn ▴ 30
@jenn-11033
Last seen 18 months ago

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!

scater batch effect • 1.3k views
1
Entering edit mode
Aaron Lun ★ 27k
@alun
Last seen 9 hours ago
The city by the bay

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.