Controlling for Batch Effect and Grouping in DESEQ2
1
0
Entering edit mode
Bine ▴ 50
@bine-23912
Last seen 7 months ago
UK

Dear all,

I have the following problem: I have my model (controlling for Batch, Age, Sex) and I am interested in the condition.

dds <- DESeqDataSetFromMatrix(countData = cts,
                               colData = colData,
                               design = ~ BATCH + AGE + SEX + CONDITION

Now I need to do some grouping the condition, following vignette with

dds$group <- factor(paste0(dds$genotype, dds$condition))
design(dds) <- ~ group

But doing it this way I remove the control for Batch, Age and Sex.

How can I control for all these factors and do the grouping as well?

Thank you very much!

Bine

DESeq2 • 2.0k views
ADD COMMENT
1
Entering edit mode

Fyi, @bine, I have deleted that crosspost at biostars simply to keep information focused here in that thread. Please next time indicate crossposts by adding a link to the other community, that avoids double-effort, as often (not always) answers to these kinds of questions will be the same from different users/communities, thank you.

ADD REPLY
1
Entering edit mode
@mikelove
Last seen 16 hours ago
United States

Note: It's not great to separate all the support site posts that are related to the same analysis. Makes it hard for others to follow your threads.

If your design is not confounded (e.g. you have balanced your conditions of interest within batches or other nuisance variables) then you can do, e.g. ~batch + condition or ~batch + nuisance1 + nuisance2 + condition.

However, if you design is confounded (e.g. there are linear dependencies between the batch/nuisance variables and your condition), then you will encounter an error, in this case you should consult a statistician for resolving this in future datasets.

ADD COMMENT
0
Entering edit mode

Hi Michael, Thank you. But my problem is that i need the grouping since I want to compare specific genotype against specific condition. I cannot see any grouping in your suggestion?

ADD REPLY
1
Entering edit mode

Read condition as the grouped factor.

ADD REPLY
0
Entering edit mode

Do you mean this:

dds$group <- factor(paste0(dds$genotype, dds$condition)) design(dds) <- ~ BATCH + AGE + SEX + group ?

ADD REPLY
0
Entering edit mode

@Michael Love would that be possible?

ADD REPLY
1
Entering edit mode

Yes, I think you would benefit from working with a statistician -- the design is up to you really. I've given you pointers but really you should be making the design decisions as the analyst.

ADD REPLY

Login before adding your answer.

Traffic: 1031 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6