My experimental design has 2 genotypes - KO and WT (WT is the reference and KO is the mutated form of WT) and each of these have been treated with A. So now, I have the following sample types: WT untreated, WT+A, KO untreated, KO+A.
I want to answer the following questions:
- How do the KO samples differ from WT when both are untreated (KO vs WT; untreated)
- How do the KO samples differ from WT when both are treated with A (KO+A vs WT+A while accounting for the difference between KO and WT as KO is WT mutated. )
- How does the treatment affect WT samples (WT+A vs WT)
- How does the treatment affect KO samples (KO+A vs KO)
I have the following code so far:
#Creating the DESeq2 object and running DESeq2 on it
dds = DESeqDataSetFromMatrix(count, colData = sampletable, design = ~Batch+Genotype+Treatment+Genotype:Treatment, tidy = FALSE)
dds = DESeq(dds)
#Getting the result tables
#For answering KO vs WT (1):
ko_wt_unt = as.data.frame(results(dds, contrast = c("Genotype", "KO", "WT"), alpha = 0.05))
#For answering KO+A vs WT+A (2):
ko_wt_A = as.data.frame(results(dds, contrast = list("Genotype_KO_vs_WT", "GenotypeKO.TreatmentA"), alpha = 0.05))
#For answering WT+A vs WT (3)
A_veh_BV2 = as.data.frame(results(dds, contrast = c("Treatment", "A", "Veh"), alpha = 0.05))
#For answering KO+A vs KO
A_veh_KO = as.data.frame(results(dds, contrast = list("Treatment_A_vs_Veh", "GenotypeKO.TreatmentA"), alpha = 0.05))
#Interaction term
interaction = as.data.frame(results(dds, name = "GenotypeKO.TreatmentA", alpha = 0.05))
sessionInfo( )
My questions are:
- Is the way I have coded this correct?
- What samples is my interaction term actually comparing? I read the vignette and checked the
?results
, and it says the interaction term is for condition effect in genotype II. But the results from this differs from what I get when ko_wt_A code line is executed. Which would be the correct way to go considering that I want to adjust baseline levels so I can account for the genotype differences too? - I also read that we can add a new column which combines all the conditions and use that to essentially 'subtract' the specific samples we are interested in. I was wondering that this would be easier way for me to answer the second question, but i don't know if this approach also accounts for the baseline changes between the KO and the WT.
- When I am comparing the KO vs WT, does the formula consider samples that were treated too? Or would it only compare the untreated ones?
Thank you so much!