This might be a really stupid question, but I can't figure out how to do this. I've read through the DESeq2 vignette and manual pages but couldn't find an answer.
I have a bunch of samples split up into different conditions (eg. celltypes and disease state). I would like to make a comparison between the two possible values within one condition, but only for the samples with a specific value of the other condition.
For example, with the following samplesheet:
patient | phenotype | type
--------+-----------+-----
1 | healthy | A
1 | healthy | B
1 | sick | A
1 | sick | B
2 | healthy | A
2 | sick | A
2 | sick | B
I would like to compare "healthy" vs "sick", but only for type "A".
Currently, I have the following code, but this will also include the type "B" sample:
dds <- DESeqDataSetFromMatrix(countData=counts, colData=design, design = ~ patient + phenotype + type)
keep <- rowSums(counts(dds)) >= 10
dds <- dds[keep,]
dds <- DESeq(dds)
res <- results(dds, contrast=c("phenotype", "healthy", "sick"))
Any idea how to accomplish this?