DESeq2 one group vs multiple groups comparison in presence of batch effect
0
Entering edit mode
@aminghareyazi-21539
Last seen 8 months ago

Hi

I have 5 groups and 3 levels of batches. This is my code:

rna.o=DESeqDataSetFromMatrix(data,colD,design = ~projects+Subtypes)

rna.d.pair=DESeq(rna.o,parallel = T)

this is my resultsNames:

resultsNames(rna.d.pair) [1] "Intercept" "projectsPACA.CAvsPACA.AU" "projectsPAEN.AUvsPACA.AU" [4] "Subtypes2vs1" "Subtypes3vs1" "Subtypes4vs1"
[7] "Subtypes
5vs1"

For the next step, how should I use contrasts for one vs multiple groups for example 2 VS 1,3,4,5?

deseq2 comparison batch • 769 views
3
Entering edit mode
@mikelove
Last seen 2 days ago
United States

If you use a design of ~0 + condition + batch, then you will have a coefficient for each level of condition. This is one of the cases where it helps to not have condition at the end of the design (for convenience, we often recommend to put condition at the end, but not in this case).

Then you can do:

results(dds,
contrast=list(c("conditionA"),
c("conditionB","conditionC","conditionD","conditionE")),
listValues=c(1, -1/4))


if you wanted to compare A to the average of B-E.

0
Entering edit mode

So I just need to switch conditions in this list to get my desired comparison? should I change reference level for comparisons other than condition 1?

0
Entering edit mode

If you use the code I suggested, it doesn't matter what the reference level is, all levels will be present in the resultsNames(dds).

0
Entering edit mode

thanks Michael. It helped a lot...

0
Entering edit mode

Hi, I came across this because I am trying to do something similar, but I want to use lfcShrink, because I am working with single cell (I used zinbwave together with DESeq2). When I use the same code as above, I get an error saying that I should use coeff instead. Is there a way to "translate" the above mentioned contrast to coeff? Thank you

1
Entering edit mode
0
Entering edit mode

Thank you very much! This was super helpful