Question: edgeR error while trying to read the data
0
gravatar for ygowtha
3.4 years ago by
ygowtha20
United States
ygowtha20 wrote:

Hello All

I am really new to edgeR so please excuse me if the question is trivial. I am trying to run edgeR to perform some statistical analysis on RNA-Seq data. I was trying to follow an example on edgeR wiki version and adapting it to my experiment. However, I encountered a problem at the initial stage where I am trying to get edgeR to read my data in a text file. My code has been written below. Code lines are in italics.  Error is in bold. 

#raw data

library(edgeR)
Loading reqraw.data<-read.table(file="All_Samples1.txt",header=TRUE)
head(raw.data)

    Geneid DP12101 DP12102 DP1251 DP1252 DP1201 DP1202 DH101 DH102 DH51 DH52
1 rna22510       0       0      0      0      0      0     0     0    0    0
2 rna22511       0       0      0      0      0      0     0     0    0    0
3 rna22512       0       0      0      0      0      0     0     0    0    0
4 rna22513       0       0      0      0      0      0     0     0    0    0
5 rna22514       0       0      0      0      0      0     0     0    0    0
6 rna22515       0       0      0      0      0      0     0     0    0    0

( A background of the example I am following: The raw data in the example has an extra column in its column specifying the length of the reads. The code in that example is same as the one I used below. 

#reading data into edgeR

counts<-raw.data[,-c(1,ncol(raw.data))]
rownames(counts)<-raw.data[,1]
colnames(counts) <- paste (c (rep ("DP_10",2), rep("DP_5",2), rep("DP_0",2), rep("DH_10",2), rep("DH_5",2)), c(1:2,1:2,1:2,1:2,1:2), sep=" ")

Error in `colnames<-`(`*tmp*`, value = c("DP_10 1", "DP_10 2", "DP_5 1",  : 'names' attribute [10] must be the same length as the vector [9]

 

I believe that my error is the presence of 10 attributes in code but there are only 9 columns. And it seems to me that somewhere in the code there is a line asking it to skip the final column. Since I am new it would be great if you could help me correct the error. 

PS: I did proceed creating a dummy column at the end but I would like to learn why I was not able to correct it without adding the dummy column. I tried different variations of the code trying to omit 1 in the first two lines, but was not successful. 

 

Thank You 

 

statistics rna-seq edger R • 1.5k views
ADD COMMENTlink modified 3.4 years ago by Devon Ryan70k • written 3.4 years ago by ygowtha20
2
gravatar for Devon Ryan
3.4 years ago by
Devon Ryan70k
Freiburg, Germany
Devon Ryan70k wrote:

You might just:

raw.data<-read.table(file="All_Samples1.txt",header=TRUE, row.names=1)
colnames(counts) <- paste (c (rep ("DP_10",2), rep("DP_5",2), rep("DP_0",2), rep("DH_10",2), rep("DH_5",2)), c(1:2), sep=" ")

 

Your problem, btw, is due to this: counts<-raw.data[,-c(1,ncol(raw.data))], which is removing the first and last columns of the raw data before when creating counts while you only want to remove the first one. Either just do what I mentioned above or change this to counts<-raw.data[,-1].

ADD COMMENTlink modified 3.4 years ago • written 3.4 years ago by Devon Ryan70k

Yes, that makes sense. Thank you. 

ADD REPLYlink written 3.4 years ago by ygowtha20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1399 users visited in the last hour