This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DESeq2: Multiple disease condition vs Normal

Hello!

I have an mRNA dataset with one cell type and 3 different conditions (Metastatic, Primary Tumor, and Solid Tissue Normal).

I would like to compare the two diseased conditions with the normal. I am using the following code but getting the understated error.

deseq_res <- results(deseq_obj, contrast = list ( c('Primary Tumor', 'Metastatic'), c('Solid Tissue Normal')) , listValues=c(1, -1/3), alpha = 0.05, lfcThreshold = 1.5)

-------------------------------------------------------------------------------------------------------------------------------------------------------

Error in checkContrast(contrast, resNames) : 
  all elements of the contrast as a list of length 2 should be elements of 'resultsNames(object)'

I have checked if the names of the condition are identical to the ones in the dataset and they are. What can I do in this case?

Thanks in advance

deseq2 rnaseq

1 answer

Assuming you appropriately imported your count matrix and coldata, and:

all(rownames(coldata) == colnames(count_matrix))

reports TRUE,

do so:

deseq_obj$tissue_type <- relevel(deseq_obj$tissue_type, ref = "Solid Tissue Normal")
dds <- DESeq(deseq_obj)
design(dds) <- formula(~tissue_type)
resultsNames(dds)
res <- results(dds, name="tissue_type_Primary Tumor_vs_Solid Tissue Normal")

assuming that "tissue_type" is a column name in your coldata for grouping individual samples based on condition. Also the argument passed to name in the last line of code should be identical to the results of resultsNames.

I also recommend replacing all spaces with underscores. Whatever codes you are dealing with, blank spaces will make your life complicated.

Log in to answer this question.