<p>The hint is here:</p>
<p><code>duplicate 'row.names' are not allowed</code></p>
<p><code>rownames(data)</code> should return a vector of only unique values, since it doesn't make sense to have the same gene/transcript in two different rows of your count matrix. How did you generate it?</p>
<p>What does <code>which(duplicated(rownames(data)))</code> return? Maybe that'll give you a hint on what went wrong. In general, if you use <code>salmon</code> or <code>kallisto</code> for counting, you should use the excellent <code>tximport</code> package to get the counts into R, then create a DESeq dataset with <code>DESeqDataSetFromTximport()</code>.</p>
<p>EDITS:</p>
<p>The replies to my answer prompted me to re-read your post and I saw that you had set <code>tidy=TRUE</code>, which means the duplicates are actually in your first column of your <code>data</code>.</p>

CC BY-SA 4.0
2020-11-01T17:52:01.757Z
I thought along the same lines, but `data` cannot have duplicate `row.names` - no object can have duplicate `row.names`, so this is some generated object that is being assigned duplicate row names owing to something wrong with `data` or `labelData` that has nothing to do with the row names of either object.
Ram RS
CC BY-SA 4.0
2020-11-01T18:23:57.017Z
Of course, they can. Here's a oneliner for you: `m <- matrix(0, nrow=3, ncol=3, dimnames=list(c('a', 'a', 'a'), c('b', 'b', 'b')))`. Anyway, I tried and DESeq2 handles this case semi-gracefully by appending numbers to the dupes. However, @Athanasia had set `tidy=TRUE`, which prompts DESeq2 to look for row names in the first column of the input, where duplicates trigger an error. I can post an MRE for this exact behavior if you'd like.
Bastian Schiffthaler
CC BY-SA 4.0
2020-11-01T21:14:42.783Z
Thank you, TIL.
Ram RS
CC BY-SA 4.0
2020-10-31T19:10:05.693Z
2020-11-01T18:21:06.297Z
2020-11-01T18:21:06.297Z
Bastian Schiffthaler
<p>I am using DESEQ2 for RNAseq analysis but i do not understand why I get this error.</p>
<pre><code>&gt; dds &lt;- DESeqDataSetFromMatrix(countData = data, 
+                               colData = labeldata, 
+                               design =~ subtype, tidy = TRUE)

**Error** in `.rowNamesDF&lt;-`(x, value = value) : 
  duplicate 'row.names' are not allowed
</code></pre>
<p>I really do not know what is the issue. Could you please help?</p>
<p>Thanks</p>

CC BY-SA 4.0
2020-10-31T15:25:02.550Z
Hi @athanasia and thansk for your post. Members here do experience of DESEQ2 for transformation (I don't) and whilst the information could be enough, it is etiquette to provide as much detail as you can. For example, your data, size dimension, runs etc. ...
M__
CC BY-SA 4.0
2020-10-31T18:49:58.237Z
Please edit your question to include the output of ``dput(head(data))``. thanks
user438383
<r><rna-seq>
DESEQ2:Error in rownames, what is the problem?
# DESEQ2:Error in rownames, what is the problem?

(Asked by: username_0 on 2020-10-31)

I am using DESEQ2 for RNAseq analysis but i do not understand why I get this error.
> dds <- DESeqDataSetFromMatrix(countData = data, 
+                               colData = labeldata, 
+                               design =~ subtype, tidy = TRUE)

**Error** in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed

I really do not know what is the issue. Could you please help?
Thanks

**Tags:** r, rna-seq
> **Comments:**
> **username_1**: Hi @athanasia and thansk for your post. Members here do experience of DESEQ2 for transformation (I don't) and whilst the information could be enough, it is etiquette to provide as much detail as you can. For example, your data, size dimension, runs etc. ...  
> **username_2**: Please edit your question to include the output of ``dput(head(data))``. thanks  

---

## 1 answers

### Answer by username_3 on 2020-10-31. Score: 3

The hint is here:

`duplicate 'row.names' are not allowed`

`rownames(data)` should return a vector of only unique values, since it doesn't make sense to have the same gene/transcript in two different rows of your count matrix. How did you generate it?

What does `which(duplicated(rownames(data)))` return? Maybe that'll give you a hint on what went wrong. In general, if you use `salmon` or `kallisto` for counting, you should use the excellent `tximport` package to get the counts into R, then create a DESeq dataset with `DESeqDataSetFromTximport()`.

EDITS:

The replies to my answer prompted me to re-read your post and I saw that you had set `tidy=TRUE`, which means the duplicates are actually in your first column of your `data`.

> **Comments:**
> **username_4**: I thought along the same lines, but `data` cannot have duplicate `row.names` - no object can have duplicate `row.names`, so this is some generated object that is being assigned duplicate row names owing to something wrong with `data` or `labelData` that has nothing to do with the row names of either object.  
> **username_3**: Of course, they can. Here's a oneliner for you: `m <- matrix(0, nrow=3, ncol=3, dimnames=list(c('a', 'a', 'a'), c('b', 'b', 'b')))`. Anyway, I tried and DESeq2 handles this case semi-gracefully by appending numbers to the dupes. However, @Athanasia had set `tidy=TRUE`, which prompts DESeq2 to look for row names in the first column of the input, where duplicates trigger an error. I can post an MRE for this exact behavior if you'd like.  
> **username_4**: Thank you, TIL.  

---

