tximport error: vroom
1
1
Entering edit mode
RLiu ▴ 40
@7cbf87e1
Last seen 6 months ago
Canada

I'm trying to import a list of salmon counts files quant.sf:

txi <- tximport(files=files, type="salmon", tx2gene=tx2gene[,c("refseq", "entrezid")], countsFromAbundance="lengthScaledTPM")

Rstudio threw me an error:

reading in files with read_tsv
1 Error in vroom_(file, delim = delim %||% col_types$delim, col_names = col_names,  : 
  bad value

why did it happen?

Here are what files and tx2gene look like:

> head(files)
                                                       cy201702 
"/Users/maxineliu/work/bufo/RNA/salmon/cy201702_quant/quant.sf" 
                                                       cy201802 
"/Users/maxineliu/work/bufo/RNA/salmon/cy201802_quant/quant.sf" 
                                                       cy201902 
"/Users/maxineliu/work/bufo/RNA/salmon/cy201902_quant/quant.sf" 
                                                       cy202302 
"/Users/maxineliu/work/bufo/RNA/salmon/cy202302_quant/quant.sf" 
                                                       cy202402 
"/Users/maxineliu/work/bufo/RNA/salmon/cy202402_quant/quant.sf" 
                                                       cy202502 
"/Users/maxineliu/work/bufo/RNA/salmon/cy202502_quant/quant.sf"
head(tx2gene[,c("refseq", "entrezid")])
          refseq  entrezid
1 XM_044268240.1 122946843
2 XM_044268241.1 122919300
3 XM_044268242.1 122919300
4 XM_044268243.1 122919300
5 XM_044268244.1 122919301
6 XM_044268245.1 122919299
tximport • 1.9k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
1
Entering edit mode
@mikelove
Last seen 1 hour ago
United States

Check that they all have same number of lines. I guess one of them was interrupted while writing out and may need to be re-run (Salmon).

Seems an issue with readr (see below). Try importer=read.delim

ADD COMMENT
1
Entering edit mode

I checked that all quant.sfs have the same line number (42013 lines in each file), which is different from tx2gene (81493 lines).

ADD REPLY
0
Entering edit mode

I also ran into this same issue today. All my quant.sf files are the same length, were generated within the last month, do not contain comments at the beginning (see the cross-post's suggestion), and worked with tximport until today (I've used the same script for the past three weeks).

My tx2gene is 34403 rows long. All of my quant.sf files are 32262 rows long.

I think this is due to an issue with vroom. My old script was on vroom_1.6.3. I updated today from vroom_1.6.3 to vroom_1.6.4 and this issue began afterwards. I believe this is the reason since readr which also depends on vroom gives me the same error, while data.table::fread (doesn't depend on vroom) does not throw an error.

> # Use readr
> data <- readr::read_delim("path/quant.sf", "\t")
  Error in vroom_(file, delim = delim %||% col_types$delim, col_names = col_names,  :                                                                                                                         
  bad value

> # Use fread from data.table
> data <- data.table::fread("path/quant.sf")

I've tried to downgrade back to vroom_1.6.3, but I still get the same error, so I might be totally wrong that it is vroom's fault or something else might be going wrong I'm not sure how to fix.

ADD REPLY
1
Entering edit mode

Thank you for providing this clue. I never installed vroom manually. I guess it is one of dependences for tximport that automatically installed in R.

ADD REPLY
1
Entering edit mode

Of course! Let me know if you figure it out.

ADD REPLY
3
Entering edit mode

You can force the function used for importing:

https://github.com/thelovelab/tximport/blob/devel/R/tximport.R#L265

Try importer=read.delim

ADD REPLY
1
Entering edit mode

Worked perfectly! Thanks!

ADD REPLY
1
Entering edit mode

yes! worked perfectly! Thank you~

ADD REPLY
0
Entering edit mode

Hi Mike - I'm having the same issue with tximeta. Would you mind posting a how-to for how to edit the function in RStudio? thx.

ADD REPLY
0
Entering edit mode

genes_results = tximport(files, type = 'rsem', txIn = F, txOut = F, ignoreTxVersion = TRUE, importer = read.delim)

you can change the type to whatever you used to align. I hope this helps.

ADD REPLY

Login before adding your answer.

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