<p>I'm getting the following error in a DESeq2 analysis and I can't seem to figure out the issue:</p>
<p><code>Error in `assays&lt;-`(`*tmp*`, withDimnames = withDimnames, ..., value = `*vtmp*`) :  please use 'assay(x, withDimnames=FALSE)) &lt;- value' or 'assays(x, withDimnames=FALSE)) &lt;- value' when the dimnames on the supplied assay(s) are not identical to the dimnames on RangedSummarizedExperiment object 'x'</code></p>
<p>Here is my code:</p>
<pre class="lang-r prettyprint-override"><code>library(DESeq2)
library(edgeR)

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

files &lt;- c(&quot;GSM1545535_10_6_5_11.txt&quot;, &quot;GSM1545536_9_6_5_11.txt&quot;, 
           &quot;GSM1545538_purep53.txt&quot;, &quot;GSM1545539_JMS8-2.txt&quot;, 
           &quot;GSM1545540_JMS8-3.txt&quot;, &quot;GSM1545541_JMS8-4.txt&quot;, 
           &quot;GSM1545542_JMS8-5.txt&quot;, &quot;GSM1545544_JMS9-P7c.txt&quot;, 
           &quot;GSM1545545_JMS9-P8c.txt&quot;)

x &lt;- readDGE(files, columns=c(1,3))

samplenames &lt;- substring(colnames(x), 12, nchar(colnames(x)))

colnames(x) &lt;- samplenames
group &lt;- as.factor(c(&quot;LP&quot;, &quot;ML&quot;, &quot;Basal&quot;, &quot;Basal&quot;, &quot;ML&quot;, &quot;LP&quot;, 
                     &quot;Basal&quot;, &quot;ML&quot;, &quot;LP&quot;))
x<span class="math-container">$samples$</span>group &lt;- group

#DESeq2 Analysis
phenodata &lt;- new(&quot;AnnotatedDataFrame&quot;, data = data.frame(celltype = x<span class="math-container">$samples$</span>group))
counts &lt;- x$counts
ids &lt;- c(1,3,4,6,7,9)

tmpcounts = counts[, ids]
tmpph = as(phenodata[ids, ], &quot;data.frame&quot;)
rownames(tmpph) &lt;- colnames(tmpcounts)

dds = DESeqDataSetFromMatrix(countData = tmpcounts, colData = tmpph, design = ~ tmpph$celltype)
</code></pre>
<p>Here are my package versions</p>
<pre><code>&gt; packageVersion(&quot;DESeq2&quot;)
[1] ‘1.30.1’

&gt; packageVersion(&quot;SummarizedExperiment&quot;)
[1] ‘1.20.0’
</code></pre>

<rna-seq><deseq2>
Error in DESeq2 analysis with dimnames
# Error in DESeq2 analysis with dimnames

(Asked by: username_0 on 2022-04-26)

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:
library(DESeq2)
library(edgeR)

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", 
           "GSM1545545_JMS9-P8c.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’

**Tags:** rna-seq, deseq2

---

## 0 answers

