I have an experimental design with 4 groups, 6 replicates per group (1 control group "A", and 3 treatment groups "B", "C", and "D").

My design is ~ condition

My code is as follows:

```
dds <- DESeqDataSetFromMatrix(countData=my.counts, colData=coldata, design= ~ condition)
dds <- estimateSizeFactors(dds)
dds <- DESeq(dds)
resultsNames(dds)
[1] "Intercept" "gr_B_vs_A" "gr_C_vs_A" "gr_D_vs_A"
```

I am not sure how to define some of my comparisons of interest, primarily the comparison of comparisons:

(D - C) - (B - A)

Is it possible to define this contrast from the resultsNames above?

As an aside, I attempted to use the resultsNames to perform one comparison (D - C) in two ways: Once by specifying the "contrast" parameter of the results function like so:

```
res <- results(dds, contrast=c("condition", "D", "C"))
```

And again by utilizing the resultsNames like so:

```
res <- results(dds, contrast=list(c("gr_D_vs_A","gr_C_vs_A"))
```

I was thinking that they should be equivalent due to (D - A) - (C - A) = D - C, but I obtain different numbers of significant DE Genes from these two methods so it seems like my thinking is incorrect.

I am using DESeq2 version 1.22.2

Thanks for your help,

Brett

Thanks Michael,

I have read the interaction section of the vignette but I am having trouble taking that information/example and applying it to my design.

Do you have input on whether the two results examples I provided are two ways of performing the same contrast (D - C)? And if they should then have identical results in terms of DE Genes passing an adjusted pvalue cutoff?

You should make two new factors, say X and Y,

Such that:

X=0 and Y=0 => condition A

...

X=1 and Y=1 => condition D

Then test the X:Y interaction term.