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.
- Compare glucose and galactose treatment within controls.
- 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
Ah yes of course. It prints out
and then a bit of the dataframe.
Silly me, it looks like the comparison I wanted was already defined.
Thankyou for your help.
Please accept my answer to provide closure to the post.