DESeq2 - Struggling to Define Desired Contrast
1
0
Entering edit mode
9 months ago

Hi all,

I am currently analysing some RNA seq data in which I have cases and controls which have each been treated with either glucose or galactose.

I would like to run two tests.

  1. Compare glucose and galactose treatment within controls.
  2. Compare glucose and galactose treatment within cases.

However, I have been struggling to define both of these contrasts.

For context, my metadata contains the following variables; condition (case/control), treatment (glucose/galactose), condition_treatment. (a combination of the condition and treatment variables which has 4 levels)

Below is the code in which I attempt to compare treatment within controls:

dds_glu_gal <- DESeqDataSetFromMatrix(counts, meta, design = ~condition_treatment)

dds_glu_gal <- DESeq(dds_glu_gal)

#Define contrast
contrast_condition <- c("condition_treatment", "control_glucose", "control_galactose")

#Extract results
res_table_control_gg <- results(dds_glu_gal, contrast = contrast_condition, alpha = 0.05)


#Apply LFC shrinkage 
resultsNames(dds_glu_gal)
[1] "Intercept"                                              
[2] "condition_treatment_case_glucose_vs_case_galactose"     
[3] "condition_treatment_control_galactose_vs_case_galactose"
[4] "condition_treatment_control_glucose_vs_case_galactose"

As you can see, there is no contrast which compares glucose and galactose treatment within controls. At first I though this contrast may be contained within the intercept term. However, the reference level for the condition_treatment variable is case_glucose. If have not misunderstood, then the intercept term should be defined by the factor reference level?

Would you have any idea what I can do? I'm fairly sure I have missed something basic!

Many thanks,
Rob

RNA-Seq DESeq2 • 506 views
ADD COMMENT
1
Entering edit mode
9 months ago
Ram 44k

What does typing in just res_table_control_gg on the R command line print? You're comparing resultNames(dds_glu_gal) to your requirement. The result names shown have nothing to do with the lines before that involving the contrast_condition variable, the result names are from the DESeq(dds_glu_gal) call.

ADD COMMENT
0
Entering edit mode

Ah yes of course. It prints out

log2 fold change (MLE): condition_treatment control_glucose vs control_galactose 
Wald test p-value: condition_treatment control_glucose vs control_galactose 

DataFrame with 26485 rows and 6 columns

and then a bit of the dataframe.

Silly me, it looks like the comparison I wanted was already defined.

Thankyou for your help.

ADD REPLY
0
Entering edit mode

Please accept my answer to provide closure to the post.

ADD REPLY

Login before adding your answer.

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