Hi,
I am encountering an error which I cannot solve when attempting a contrast that references a list.
"dx" is a column in my design file and each sample row has a value of "dx1", "dx2", or "dx3" in this column.
"batch" is a column with three possible values "group1", "group2", "group3".
Now I want to run DESeq and then look for genes differentially expressed in "dx1" vs both other groups combined, then look in "dx2" vs the other two, etc. I am referencing the following examples:
- DESeq2: one condition vs multiple combined
- Using the "listValues" argument of DESEQ in multiple group comparisons
Here is the relevant code:
dds <- DESeqDataSetFromMatrix(countData = read_counts, colData = design.file, design = ~ batch + dx)
dds <- DESeq(dds, parallel=TRUE)
res1 <- results(dds, contrast = list( c("dx1"),c("dx2","dx3") ), listValues=c(1,-1/2) )
which produces this error:
Error in checkContrast(contrast, resNames) :
all elements of the contrast as a list of length 2 should be elements of 'resultsNames(object)'
A look into resultsNames(dds) reveals this list:
[1] "Intercept" "batch_group2_vs_group1" "batch_group3_vs_group1" "dx_dx2_vs_dx1"
[5] "dx_dx3_vs_dx1"
Any idea what is the problem? Thanks in advance.
RStudio Version 1.1.414 ; R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/604.4.7 (KHTML, like Gecko)