This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DESeq2 contrast multiple treated conditions versus multiple control conditions

Dear all,

I have 4 treated and 2 control conditions.

treated1 treated2 treated3 treated4
control1 control2

From my PCA plot I could see that treated1, 2, 3 form a cluster and I want to compare these cluster against both control 1 and 2. I know in DESeq2 for two conditions it is possible to do like this:

res <- results(dds, contrast=c("condition","treated1","control1"), alpha = 0.0001)

But I want to do somethins like in this pseudocode. How to do this in DESeq2?

res <- results(dds, contrast=c("condition","treated1" ,"treated2","treated3" VERSUS "control1","control2")), alpha = 0.0001)

Cross-posted: https://support.bioconductor.org/p/9141807/

rnaseq deseq2

1 answer

I think you can get results to work with roughly that syntax (check here for examples:https://rdrr.io/bioc/DESeq2/man/results.html)

Or, you can make a new column of colData with contents that groups what you want together, and make that column your design instead of condition.

(group <- factor(c("treated1","treated1","treated2","treated2","treated3","treated3","treated4","treated4","control1","control1","control2","control2")))
(coldata <- data.frame(row.names=colnames(txi.g), group))
dds <- DESeqDataSetFromTximport(txi.g, colData=coldata, design=~group)
dds <- DESeq(dds)
res <- DESeq2::results(dds, 
               contrast = list(c("treated1","treated2","treated3"),c("control1","control2")), 
               listValues = c(3,-3/5)

This gives me this error, this is because deseq created already the contrasts ie. "condition_treated1_vs_control1" ,With two sample comparison I used to do like this contrast=c("condition","treated1","control1").

Error in checkContrast(contrast, resNames) : 
  all elements of the contrast as a list of length 2 should be elements of 'resultsNames(object)'

also since I have 3 rep each, does this create some problem due to unequal size of samples, ie. 9 treated samples vs 6 o3 controls.

Comparing 6 to 9 samples is not a problem.. As for the rest, read the page I specified to get the correct syntax if you want to do it that way. Or do it the other way.

Log in to answer this question.