Seeing as how the rest of my pipeline is in DESeq2, and solutions that are provided in this package?
Hello I have three groups A, B, and C I want design to be (1) A vs (B and C) (2) B vs (A and C) and (3) C vs (A and B). However with contrast parameter inside of results from DESeq2, it seems that I can only choose two at a time? What should I do? Thanks
2 answers
The official way is to specify a contrast matrix, which can be created something like this:
> limma::makeContrasts(groupAvsBC=2*A-B-C,groupBvsAC=2*B-A-C, groupCvsAB=2*C-A-B,levels=c('A', 'B', 'C'))
Contrasts
Levels groupAvsBC groupBvsAC groupCvsAB
A 2 -1 -1
B -1 2 -1
C -1 -1 2
That said, many times I simply cheat and set dat$metaGroupA = ifelse(dat$group == 'A', 'A', 'B_or_C') and keep a simple contrast.
You can pass the contrast matrix into DESeq2 results directly:
result(dds, contrast=contrast.matrix[,'groupBvsAC'])
"Alternatively, a numeric vector of the length of resultsNames(dds) can be provided, for manually specifying the linear combination of terms."
The call to limma:makeContrasts simply helps to get the correct numeric vector; but you can create it manually.
Just make new columns in colData that have the groups the way you want them. That's simple and readable.
Log in to answer this question.