How to combine different "groups" in DESeq2 constrast
2
0
Entering edit mode
20 months ago
biotrekker ▴ 110

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

rnaseq DESeq2 • 1.1k views
ADD COMMENT
2
Entering edit mode
20 months ago
LChart 4.6k

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.

ADD COMMENT
0
Entering edit mode

Seeing as how the rest of my pipeline is in DESeq2, and solutions that are provided in this package?

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
1
Entering edit mode
20 months ago

Just make new columns in colData that have the groups the way you want them. That's simple and readable.

ADD COMMENT

Login before adding your answer.

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