Search
Question: Comparing one condition to multiple others using DESeq2 contrasts
1
11 months ago by
thibault.lorin3420 wrote:

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.

modified 11 months ago by Sean Davis21k • written 11 months ago by thibault.lorin3420

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?

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!

2
11 months ago by
Sean Davis21k
United States
Sean Davis21k wrote:

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.

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-)

2

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.

1

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