edgeR error related to tximport
1
0
Entering edit mode
6.5 years ago
Sharon ▴ 600

This is how my genes counts for 20 samples (samples.counts) look like after I use tximport

"A1BG"  36      25      86.6477 63.4772 35      52.5212 60.4882 56      48.2592 72      249.791 92.4645 153.648 45      47.4755 114     83.681  40      29
      48
"A1BG-AS1"      19.5653 20.1798 23.1489 26.9487 15.0825 21.443  26.3997 17.3013 22.9056 27.074  40.0216 47.2076 40.5643 23.8753 13.4993 49.6921 76.8333 15.5382 41.0976 28.8201
"A1CF"  13.010933916668 22.39929531177  18.008595488922 27.027765886534 11.00391966995  18.085480884669 20.0053316502991        18.0519314747599        70.95300027799  30.046155291935 31.0514300951225        24.007643214371 25.2221677791356        21.0332022633268        17.0271805392289        11.007392116412 174.169913899553        13.005983320901 119.193114961   31.0094

My code is as follow:

labels=c("ctrl_1", "ctrl_2", "ctrl_3", "ctrl_4", "ctrl_5", "ctrl_6", "ctrl_7", "ctrl_8", "ctrl_9", "ctrl_10","tr_1", "tr_2","tr_3", "tr_4", "tr_5", "tr_6",
         "tr_7", "tr_8", "tr_9", "tr_10") 

data <- readDGE(“samples.counts")
print (data)
group <- c(rep("ctrl", 10), rep("tr", 10))
dge = DGEList(counts=data,group=group)
dge <- calcNormFactors(dge)
dge <- estimateCommonDisp(dge)
dge <- estimateTagwiseDisp(dge)

et <- exactTest(dge, pair=c("ctrl", "tr"))
etp <- topTags(et, n=100000)
etp$table$logFC = -etp$table$logFC

It throws this error:

Error in DGEList(counts = data, group = group) : Length of 'group' must equal number of columns in 'counts'

I understand where is the issue but don’t know how to solve. I think readDGE expects a list of files, one file per sample , but I am passing one file. it reads only one count for one sample and ignores the rest which causes the error. But I don't know how to proceed to fix. I am still new to R and bioconductor so I appreciate your help.

RNA-Seq edgeR tximport • 3.2k views
ADD COMMENT
0
Entering edit mode
6.5 years ago

Do the following:

row.names(data) = data[,1]
data = data[,-1]

Your problem is simply that your first column isn't being treated as a row label, so there's an extra column.

ADD COMMENT
0
Entering edit mode

Thanks. But I think it is still not resolved, it throws a similar error ?

Error in dimnames(x$counts) <- value : length of 'dimnames' [1] not equal to array extent

ADD REPLY
0
Entering edit mode

What exactly is throwing that error?

ADD REPLY
0
Entering edit mode

I think the problem is here :

> data <- readDGE(“samples.counts")

readDGE expect a list of files, but since I converted my transcripts counts I get from salmon to genes count using tximport. I get one file for all gene counts in one file. So I think readDGE uses one column in the samples.counts and ignores the rest. This is what I think. I just get the error above.

ADD REPLY

Login before adding your answer.

Traffic: 2691 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