I'm getting the following error in a DESeq2 analysis and I can't seem to figure out the issue:

Error in `assays<-`(`*tmp*`, withDimnames = withDimnames, ..., value = `*vtmp*`) : please use 'assay(x, withDimnames=FALSE)) <- value' or 'assays(x, withDimnames=FALSE)) <- value' when the dimnames on the supplied assay(s) are not identical to the dimnames on RangedSummarizedExperiment object 'x'

Here is my code:


url <- "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE63310&format=file"
utils::download.file(url, destfile="GSE63310_RAW.tar", mode="wb") 
utils::untar("GSE63310_RAW.tar", exdir = ".")
files <- c("GSM1545535_10_6_5_11.txt", "GSM1545536_9_6_5_11.txt", "GSM1545538_purep53.txt",
           "GSM1545539_JMS8-2.txt", "GSM1545540_JMS8-3.txt", "GSM1545541_JMS8-4.txt",
           "GSM1545542_JMS8-5.txt", "GSM1545544_JMS9-P7c.txt", "GSM1545545_JMS9-P8c.txt")
for(i in paste(files, ".gz", sep=""))
  R.utils::gunzip(i, overwrite=TRUE)

files <- c("GSM1545535_10_6_5_11.txt", "GSM1545536_9_6_5_11.txt", 
           "GSM1545538_purep53.txt", "GSM1545539_JMS8-2.txt", 
           "GSM1545540_JMS8-3.txt", "GSM1545541_JMS8-4.txt", 
           "GSM1545542_JMS8-5.txt", "GSM1545544_JMS9-P7c.txt", 

x <- readDGE(files, columns=c(1,3))

samplenames <- substring(colnames(x), 12, nchar(colnames(x)))

colnames(x) <- samplenames
group <- as.factor(c("LP", "ML", "Basal", "Basal", "ML", "LP", 
                     "Basal", "ML", "LP"))
x$samples$group <- group

#DESeq2 Analysis
phenodata <- new("AnnotatedDataFrame", data = data.frame(celltype = x$samples$group))
counts <- x$counts
ids <- c(1,3,4,6,7,9)

tmpcounts = counts[, ids]
tmpph = as(phenodata[ids, ], "data.frame")
rownames(tmpph) <- colnames(tmpcounts)

dds = DESeqDataSetFromMatrix(countData = tmpcounts, colData = tmpph, design = ~ tmpph$celltype)

Here are my package versions

> packageVersion("DESeq2")
[1] ‘1.30.1’

> packageVersion("SummarizedExperiment")
[1] ‘1.20.0’

1 Answer 1


What works is:

dds = DESeqDataSetFromMatrix(countData = data.frame(tmpcounts), colData = tmpph, design = ~celltype)

Mind the data.frame() around the count data object (which was a matrix) and removal of tmpph$ for the design because design should reference one or more columns of the colData. In newer versions of DESeq2 that by the way works without the data.frame() but I am not sure why. You might want to dig that out yourself, looking at the source code of how exactly the package (SummarizedExperiment) feeds data as an assay into a SummarizedExperiments object.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.