Hi all, I recently started analyzing some bacterial RNAseq data. So, I have 4 different strains and for each strain I have 2 conditions. Let's say strains are A, B, C and D while conditions are X and Y. I have a total of 24 samples (3 replicate per strain and condition, for example strain A in condition X has 3 replicates and so on). I made a count matrix with the raw read counts from all my samples and coldata with 2 columns : strain and condition. I made each column as a factor.
I have a few questions:
I am primarily interested in getting differences between the strains keeping the condition in mind. So, is using
design~ condition+strain
sufficient? (Note, after doing PCA I found out that most of my variance actually comes from the different conditions and not the different strains but I'm interested in the difference between the strains).Next, I know how to get results between different factor levels inside a variable using contrast. Like, If I wanted to get results between strain A and strain B, I would go like
results(dds, contrast=c("strain","A","B"))
while if I wanted to compare just my conditions it would beresults(dds, contrast=c("condition","X","Y"))
.
Now the first code would give me differences between strain A and B for both conditions combined (all 6 samples of strain A vs all 6 samples of strain B). What if I just wanted to get differences between strain A and B in just condition X (3 samples of strain A in condition X vs 3 samples of strain B in condition X) or just condition Y. How do I do that using results?
Or do I need to make 2 separate dds objects for each condition and do it?
Any help will be appreciated. Thanks!!
Okay, so if I got this correctly, I want to do something like
dds$group <- factor(paste0(dds$strain, dds$condition))
design(dds) <- ~ group
dds <- DESeq(dds)
results(dds, contrast=c("group", "BX", "AX"))
and this should give me the results table for strain B vs strain A for condition X? Right?
If so, this should be simple enough and I can use this to get all the comparisons I need.
Thanks a lot.