Tximport with RSEM error
1
1
Entering edit mode
hs.lansdell ▴ 20
@hslansdell-14246
Last seen 7.0 years ago

Hello! I am new to both RSEM and tximport, so I am unsure which this is an issue with. All of my RNA seq samples are in separate SampleName.rsem.genes.results files in one directory. Based on the vignette, it almost seems like all the samples should be in one gene.results file? Either way, I attempted to pack the files and read them in via the below code:

library(tximport)

rsem.files=list.files(".","*.genes.results")

txi.rsem=tximport(rsem.files, type = "rsem")

And got the following error:

reading in files with read.delim (install 'readr' package for speed up)
1 Error: all(c(geneIdCol, abundanceCol, lengthCol) %in% names(raw)) is not TRUE

Thank you for any feedback!

RSEM • 5.1k views
ADD COMMENT
0
Entering edit mode
@kvittingseerup-7956
Last seen 15 months ago
European Union

I think you need to supply to tximport is a vector of strings pointing to each of the isoform expression file you want to import.

If you want the gene expression you should use the tx2gene option in the tximport() function (letting tximport summing up the gene expression).

Try running the example from the tximport vignette and see what the input needs to be.

ADD COMMENT
0
Entering edit mode

Thanks for yours thoughts, I started just at the RSEM section and missed the making of the vector. It would be helpful to see the example inputs, so I tried running the vignette examples, but I cannot locate the 'extdata' anywhere within the package. When I run the command:

dir <- system.file("extdata", package = "tximportData")
list.files(dir)

I get:

character(0)

ADD REPLY
0
Entering edit mode

Note this part of the sentence in the vignette when we talk about building the 'files' vector:

"First, we locate the directory containing the files. (Here we use system.file to locate the package directory, but for a typical use, we would just provide a path, e.g. "/path/to/dir".)"

ADD REPLY
0
Entering edit mode

Which I understand and have done, what I'm trying to understand now is what the sample.txt file should look like. 

ADD REPLY
0
Entering edit mode

Ok, one thing I'm not sure about: right now, are you trying to work with your own RSEM files, or re-run the vignette code?

tximport() can import the 'genes.results' files for RSEM by setting type="rsem".

If you want RSEM quantifications on at the transcript level, you can set these columns below manually. We didn't implement an transcript-level preset for RSEM, just the gene-level import.

txi <- tximport(files, txOut=TRUE,
​  txIdCol="transcript_id", abundanceCol="FPKM",
  countsCol="expected_count", lengthCol="effective_length")

 

ADD REPLY
0
Entering edit mode

I was trying to run the vignette code just to make sure I formatted my own files correctly. I want to run my own genes.results files. I'm trying to determine if a sample.txt file is needed for that as it states here:

RSEM sample.genes.results files can be imported by setting type to "rsem".

files <- file.path(dir, "rsem", samples$run, paste0(samples$run, ".genes.results"))

I thought the samples variable was made from a .txt file. As seen earlier in the vignette:

samples <- read.table(file.path(dir, "samples.txt"), header = TRUE)

Do I need a sample.txt file made to run tximport on genes.results files? I tried just running the following:

txi.rsem=tximport(files, type = "rsem")

With files being all my genes.results files. 

I get the following error:

reading in files with read.delim (install 'readr' package for speed up)
1 Error: all(c(geneIdCol, abundanceCol, lengthCol) %in% names(raw)) is not TRUE

 

ADD REPLY
0
Entering edit mode

Maybe you can do a bit of debugging. tximport() is looking for these column names in each of the files.

    geneIdCol <- "gene_id"
    abundanceCol <- "FPKM"
    countsCol <- "expected_count"
    lengthCol <- "effective_length"

Can you confirm that all the files in 'files' have these columns?

ADD REPLY
0
Entering edit mode

My files have no column names. From what I can tell my file formats seems to be gene_id some# some# and transcript_id. I reached out to the person who processed the files. Turns out they used rsem v1.1.13.... which has different columns. I'll see if I can import it manually. 

Thanks!

ADD REPLY
0
Entering edit mode

I came across this question because I am similarly confused with using tximport (and very new to R in general). I am working on a class project and what I have are RSEM files which I would like to do further analysis with DESeq2. I'm having problems with reading in the files. The rsem txt files which I've downloaded (9 individual files) have the following columns:

gene_id, transcript_id, length, effective_length, expected_count, TPM, FPKM

When I tried to run this:

```{r }

files=file.path("~/Applied Bioinformatics/STATS 555/Project/GSE101642_RAW")
txi.rsem=tximport(files, type="rsem", txIn = FALSE, txOut = FALSE,
                  geneIdCol = "gene_id",
                  abundanceCol="FPKM",
                  countsCol="expected_count",
                  lengthCol = "effective_length")
head(txi.rsem$counts)

```

Error in computeRsemGeneLevel(files, importer, geneIdCol, abundanceCol, : all(c(geneIdCol, abundanceCol, lengthCol) %in% names(raw)) is not TRUE

I have also tried:

```{r}

txi=tximport(files,type = "rsem",txOut=TRUE, tx2gene = tx2gene, geneIdCol = "transcript_id(s)" )

```

Error in tximport(files, type = "rsem", txOut = TRUE, tx2gene = tx2gene, : all(c(lengthCol, abundanceCol) %in% names(raw)) is not TRUE

I've done various combinations of the above, where I used "gene_id" for the geneIdCol or not use the tx2gene. The authors used HG38 so I downloaded the TxDb for that version to make the table.

I am at a loss of what to do and would greatly appreciate any help. Thank you.

 

ADD REPLY
1
Entering edit mode

You need to create a vector which contains the path to all the files you want to import. So if you have 3 files you want to import the vector need to contain the path to all of them. Right now you just have a string pointing to the parent directory.

ADD REPLY
0
Entering edit mode

Thank you so much for your help! I was so frustrated on what to do but now I have all 9 files imported. 

ADD REPLY
0
Entering edit mode

I am also getting the sam error. Is it possible to know how it got imported ?

ADD REPLY
0
Entering edit mode

Would you post a new issue with example code and maybe what the files look like?

ADD REPLY

Login before adding your answer.

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