I have cell type A (untreated vs treated) and cell type B (untreated vs treated), 3 replicates for each:
sample | cell_type | treatment | combined |
---|---|---|---|
1 | A | untreated | A_untreated |
2 | A | untreated | A_untreated |
3 | A | untreated | A_untreated |
4 | A | treated | A_treated |
5 | A | treated | A_treated |
6 | A | treated | A_treated |
7 | B | untreated | B_untreated |
8 | B | untreated | B_untreated |
9 | B | untreated | B_untreated |
10 | B | treated | B_treated |
11 | B | treated | B_treated |
12 | B | treated | B_treated |
Within each cell type, to compare the treated samples to their corresponding untreated controls I'm using:
dds <- DESeqDataSet(se, design =~ combined)
de <- DESeq(dds)
results.A <- results(de, contrast=c("combined","A_treated","A_untreated"))
results.B <- results(de, contrast=c("combined","B_treated","B_untreated"))
I think I'm doing this part correctly.
Now I want to know how/if the two cell types respond differently to treatment. I don't think this is right, because it ignores the untreated controls:
results.AB <- results(de, contrast=c("combined","B_treated","A_treated")
I think I need to first normalize (if that's the right term) each treatment to its corresponding control and then compare between cell types. What is the proper way to do this (what design formula and how to extract the results), is it simply this?:
dds <- DESeqDataSet(se, design =~ cell_type + treatment)
de <- DESeq(dds)
results <- results(de)
Thank you.
Thank you for the reply. When I use design of ~celltype:treatment
I get a matrix is not full rank error. I looked at the "Model matrix not full rank" in the vignette, should I follow the instructions under "Group-specific condition effects, individuals nested within groups"?
Oops I wrote too quickly. I revised the above answer now.
Thanks I used the modified command and it worked. I get very few genes changed in the contrast which may be correct (PCA shows the samples are similar) but just want to ensure I'm doing this right:
I first had to relevel treatment:
Then analyzed as follows:
There are very few changes in results.contrast. There are also no lowcounts, is that because of the reason explained here? A: DESeq2 independent filtering fails to filter low counts
Here's an example of one gene I would have expected to be significantly changed (decreased in B.treated) in results.contrast, does it make sense (statistically) that it's not significantly changed?
Thanks for the help.
Code all seems correct. P value adjustment depends on the distribution of pvalues and on the filtering, so you can get different behavior per comparison. Some users choose to just pick the same count threshold for all results tables, and turn off independent filtering. You can do this by filtering the dds before you call results() and specifying independentFiltering=FALSE.
I checked the distribution of pvalues and the results for 'contrast' don't look right.
results.A, results.B, results.contrast:
I see this is referred to as a hill-shaped histogram, I'll have to read up on this but if you have any immediate advice on what this means or what to try next that'd be appreciated.
I also tried pre-filtering (tried values from 1 to 100), eg. for 10:
The results for A and B changed somewhat but contrast still showed only the same 3 significantly changed.
You can play with the pvalues to try to pull out differences but also let the data and current results speak to you: as you said, the groups are similar in a PCA plot.