Comparing one condition to multiple others using DESeq2 contrasts
1
1
Entering edit mode
@thibaultlorin34-14148
Last seen 6.5 years ago

I have a design with 7 conditions: S1, S2, S3, (...) S7.

I want to compare S1 to S2, S3 and S4 and find the genes overexpressed in S1 compared to each of these samples, i. e. the genes overexpressed in S1 compared to S2 and overexpressed in S1 compared to S3 and overexpressed in S1 compared to S4. Is this possible using the DESeq2 contrast approach?

What I have done is:

res <- results(dds,contrast=c("stage", c("S2","S3","S4"), "S1"))

but this gives:

> res <- results(dds,contrast=c("stage", c("S2","S3","S4"), "S1"))
Error in checkContrast(contrast, resNames) :
  'contrast', as a character vector of length 3, should have the form:
contrast = c('factorName','numeratorLevel','denominatorLevel'),
see the manual page of ?results for more information

The solution I could think of is get the intersection between the comparisons S1 and S2, S1 and S3, S1 and S4, but it would be convenient to run all comparisons at once.

Thanks for your help!

 

deseq2 • 3.5k views
ADD COMMENT
0
Entering edit mode

You need to more clearly define what you want to test. Do you want to test for differential expression between S1 and the mean of S2 through S4? Do you want to test whether S1 is significantly different from each of S2 through S4?

ADD REPLY
0
Entering edit mode
Do you want to test whether S1 is significantly different from each of S2 through S4?

Yes, this is what I'd like. I edited the post!

ADD REPLY
2
Entering edit mode
@sean-davis-490
Last seen 4 months ago
United States

Contrasts are usually between two specific groups. In your case, it appears that you want to compare `S1` to each of `S2` through `S4`. That is most easily accomplished by three separate calls to `results()`. Using a loop over a set of groups is also a possibility for a larger number of groups but might be overkill for this case.

From the three separate contrasts, you can do your filtering and overlaps.

ADD COMMENT
0
Entering edit mode

Thank you @Sean Davis!
That is most easily accomplished by three separate calls to `results()`.

Yes, this is what I could think of, but I want to compare S1 to S2, S1 to S3, S1 to S4, and then S2 to S3, S4 and S5, etc. Running each with a "one-liner" would have been more convenient B-)

ADD REPLY
2
Entering edit mode

The one-liner version answers a different question: you can use contrast with a list, where the first element is the levels in the numerator, the second element is the levels in the denominator and then listValues should be 1/n_num and 1/n_denom to indicate you are averaging (see the help page for ?results). This is a different question though: testing the average of certain levels vs the average of other levels. If you require DE among all pairs, then you need to build each results table. And you can then look at intersection. But remember that the intersection of FDR bounded sets itself doesn't have any meaningful interpretation in terms of an FDR bound. It is simply the intersection of sets.

ADD REPLY
1
Entering edit mode

Take a look at using `combn()` and a loop. 

ADD REPLY

Login before adding your answer.

Traffic: 475 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