How to use contrast with multiple treatments?
1
0
Entering edit mode
Sreeja • 0
@23ee442e
Last seen 7 months ago
India

Hi,

I am running an RNA Seq analysis for differential gene expressions for the following Biological Replicates: 3 Control, 3 Treatment A, 3 Treatment B, and 3 Treatment C.

I need to make the following comparisons: Treatment A vs Treatment B vs Treatment C with control as the reference. I am confused as to how should I write the contrasts.

This is how I have been doing it: exp_res <- results(dds, contrast = list( c("condition4HT-treated", "conditionENDX-treated"), c("condition4HT-treated", "conditionICI-treated"), c("conditionENDX-treated", "conditionICI-treated") ), alpha = 0.05, lfcThreshold = 0)

However, I am facing this error: Error in checkContrast(contrast, resNames) : 'contrast', as a list, should have length 2, or, if length 1, an empty vector will be added for the second element.

Thank you for your help.

RNASeqdataanalysis DESeq2 • 653 views
ADD COMMENT
0
Entering edit mode

Do three separate contrasts. You can, and probably should, leave all the samples in the same object.

ADD REPLY
0
Entering edit mode

Thanks for replying! Can you please explain what you mean by leaving all the samples in the same object?

ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States

Have you read the help page?

contrast: this argument specifies what comparison to extract from the
          'object' to build a results table. one of either:

            * a character vector with exactly three elements: the name
              of a factor in the design formula, the name of the
              numerator level for the fold change, and the name of the
              denominator level for the fold change (simplest case)

            * a list of 2 character vectors: the names of the fold
              changes for the numerator, and the names of the fold
              changes for the denominator. these names should be
              elements of 'resultsNames(object)'. if the list is length
              1, a second element is added which is the empty character
              vector, 'character()'. (more general case, can be to
              combine interaction terms and main effects)

            * a numeric contrast vector with one element for each
              element in 'resultsNames(object)' (most general case)

          If specified, the 'name' argument is ignored.

There is nothing in the help page that should make you think that you can use a list of arbitrary length as the contrasts argument. If you have multiple contrasts, you have to make multiple calls to results.

0
Entering edit mode

Thank you so much! Can you please explain what you mean by making multiple calls to results? I'm completely new to the field, hence these doubts!

ADD REPLY
0
Entering edit mode

You were somehow trying to get all the answers to all the questions you wanted at once. And that wasn't working. What you should do in the future is start small. Work out how to compare treatment A to control. Just that. Once you can do simple things, then you build up to complicated things.

ADD REPLY

Login before adding your answer.

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