Hi, My RNAseq dataset consist of two cultivars (R and S), three time points (1day, 3day and 7day) and two treatments (Control, Treated) with two replicates each. I have a total of 24 samples.
I am trying to find DEGs using LRT test for the following condition
> R Vs S due Treated Vs Control within 1 day
R Vs S due Treated Vs Control within 3 day
R Vs S due Treated Vs Control within 7 day
My code is
> library(DESeq2)
countdata <- read.table("Suscep_Resis_ctrl_trt_all_matrix.txt", header=TRUE, row.names=1)
countdata
countdata <- as.matrix(countdata)
countdata
colData<- read.table ("Metadata.txt", header=TRUE, row.names=1)
colData
dds <- DESeqDataSetFromMatrix(countData = countdata, colData = colData, design= ~ Genotype.S.R. + Treatmenttime.C.T. + Genotype..S.R.:Treatmenttime.C.T.)
dds
dds <- DESeqDataSetFromMatrix(countData = countdata, colData = colData, design= ~ Genotype.S.R. + Treatmenttime.C.T. + Genotype.S.R.:Treatmenttime.C.T.)
dds
dds <- dds[ rowSums(counts(dds)) > 10, ]
dds
dds <- DESeq(dds, test = "LRT", reduced = ~ Genotype.S.R. + Treatmenttime.C.T.)
resultsNames(dds)
The result names I am getting are
> resultsNames(dds)
[1] "Intercept" "Genotype.S.R._Susceptible_vs_Resistant"
[3] "Treatmenttime.C.T._ctrl3day_vs_ctrl1day" "Treatmenttime.C.T._ctrl7day_vs_ctrl1day"
[5] "Treatmenttime.C.T._trt1day_vs_ctrl1day" "Treatmenttime.C.T._trt3day_vs_ctrl1day"
[7] "Treatmenttime.C.T._trt7day_vs_ctrl1day" "Genotype.S.R.Susceptible.Treatmenttime.C.T.ctrl3day"
[9] "Genotype.S.R.Susceptible.Treatmenttime.C.T.ctrl7day" "Genotype.S.R.Susceptible.Treatmenttime.C.T.trt1day"
[11] "Genotype.S.R.Susceptible.Treatmenttime.C.T.trt3day" "Genotype.S.R.Susceptible.Treatmenttime.C.T.trt7day"
I tried to extract "Genotype.S.R.SusceptiblevsResistant" and "Treatmenttime.C.T.trt1dayvsctrl1day" using the following command
> day1 <- results(dds, contrast=list("Genotype.S.R._Susceptible_vs_Resistant", "Treatmenttime.C.T._trt1day_vs_ctrl1day"))
which is giving me a log P values of "Genotype.S.R.SusceptiblevsResistantvsTreatmenttime.C.T.trt1dayvsctrl1day"
But I am trying to get ResistantvsSusceptiblevsTreatmenttime.C.T.trt1dayvs_ctrl1day. For this I tried the relevel option but I am not getting the desired results.
Can anybody please guide me for How to rewrite the code to get my desired output as Genotype.S.R.ResistantvsSusceptiblevsTreatmenttime.C.T.trt1dayvsctrl1day

This is my actual colData
The colData(dds) after relevel
I am not sure whether I have executed the relevel option correctly. Kindly help me to figure out this query to get my desired output as Genotype.S.R.ResistantvsSusceptiblevsTreatmenttime.C.T.trt1dayvsctrl1day
Thanks - I can now see what is happening.
With a variable containing terms 'Susceptible' and 'Resistant', R will automatically set 'Resistant' as the reference level:
The left-most term ('level') is the reference level, i.e.,
ResistantDESeq2 interprets this and then automatically concludes that you want
Susceptible vs Resistant, i.e.,Resistantas the denominator. Thus, what you actually need to do is:Can you please try that?
Thank you for your suggestion. I tried the command you suggested and it worked. I am attaching the code below
I am getting the log P values for Genotype.S.R.ResistantvsSusceptiblevsTreatmenttime.C.T.trt1dayvsctrl1day
Great - thanks for providing feedback