duplicate 'row.names' are not allowed
4
0
Entering edit mode
6.4 years ago
PK ▴ 130

I have RNA-SEQ data i wanted to do DESeq (DEseq2 i am using). When i try to open my file it shows duplicate 'row.names' are not allowed like that. I already have gone through all kinds of possible ways which were discussed before but nothing worked.

This is my data

Tb927_01_v5.1     54039 54154   Novel   0   +   28     123  1   101 96  16  155 27  14  9   11

(I just highlighted every alternative tabs for your vision. I am not able to represent my data in a nice way sorry for that)

RNA-Seq software error R • 16k views
ADD COMMENT
3
Entering edit mode

This must be one of the times when R error message are actually accurate and tell you what's wrong :')

You tell R to take column 1 as row names (row.names=1)
R tells you that there are duplicates in those row names

ADD REPLY
1
Entering edit mode

What file is that? A count matrix? Please give some more details.

ADD REPLY
0
Entering edit mode

I am trying to find some new novel transcript from my sequencing file so i did multicov from bed tools to get the read counts. bedtools multicov -bams DS1.bam DS2.bam -bed transcript_I.bed > all_transcripts_I.tsv From that i took multicov output as a DESeq2 input file (all_transcripts_I.tsv).

R function i Uesd : countdata <- read.table("file5.tsv", header=TRUE, row.names=1)

The error i got : Error in read.table("file5.tsv", header = TRUE, row.names = 1) : duplicate 'row.names' are not allowed

My input file:

Tb927_01_v5.1   55903   56066   Novel_2 0   -   8   0   29  115 57  83  42  465 41  6   8   2
Tb927_01_v5.1   74188   74343   Novel_3 0   +   0   29  265 5   249 326 41  326 106 143 65  23
Tb927_01_v5.1   83979   84150   Novel_4 0   +   0   64  16  44  103 39  20  107 27  37  8   20
Tb927_01_v5.1   85231   85459   Novel_5 0   -   10  166 490 96  746 523 1186    1611    1384    809 511 216
Tb927_01_v5.1   90185   90292   Novel_6 0   +   0   25  118 2   81  117 13  131 33  33  21  7
ADD REPLY
5
Entering edit mode

Because your rownames (First row) are same and you asked R to read the file by considering first row as rownames (row.names=1). Because of indexing issue R cannot take same name for multiple rows.

In your case it looks like your fourth column seems to be non-repetitive. You can consider using row.names=4

ADD REPLY
0
Entering edit mode

@OP: remove row.names=1.

ADD REPLY
1
Entering edit mode

Please provide reproducible example data, maybe paste output of dput(head(MyData)). Also, post the command you are using that is causing the error.

ADD REPLY
0
Entering edit mode

Report the R function you used to read your file. Also provide exact error message.

ADD REPLY
0
Entering edit mode

R function i Uesd : countdata <- read.table("file5.tsv", header=TRUE, row.names=1)

The error i got : Error in read.table("file5.tsv", header = TRUE, row.names = 1) : duplicate 'row.names' are not allowed

ADD REPLY
5
Entering edit mode
6.4 years ago
Benn 8.3k

The question is also duplicate

How To Deal With Duplicate Row Names Error In R

ADD COMMENT
1
Entering edit mode
6.4 years ago
Prakash ★ 2.2k

If you still want to use first column as rownames , use Check.name= FALSE

ADD COMMENT
1
Entering edit mode
5.9 years ago

If it can help someone: I had the same error message:

Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  duplicate 'row.names' are not allowed

when importing my file :

phenodata = "C:/Users/.../phenodata.txt"
read.delim(phenodata, row.name=1)

The .txt file was beforehand generated from Excel. I don't know why but there was a bug: you just have to copy-paste in excel your matrix to a new excel sheet, then to convert to a .txt file and re-try the import process. It should work ! Good luck,

ADD COMMENT
0
Entering edit mode

Thank you! This solved my problem

ADD REPLY
0
Entering edit mode
6.4 years ago
bruce.moran ▴ 970

R will not allow you to have rownames that are the same for each row. Using a rowname in the first place is unnecessary. There is, IMHO, a better convention for data handling in R.

Install the 'tidyverse', load the library, read the count data into a tibble. The R 'base' offers a lot, but so does 'tidyverse'. Beginners should at least be aware of and try it out, and also try to understand what 'tidy' data looks like, and why it might be a good idea.

install.packages('tidyverse') 
library('tidyverse') 
countdata <- read_tsv("file5.tsv")
ADD COMMENT

Login before adding your answer.

Traffic: 1604 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6