# tx2gene file for tximport issue

I am trying to use tximport to get raw count matrices of a bulk RNA-seq sequencing experiment. I followed the tutorial:

https://bioconductor.org/packages/3.7/bioc/vignettes/tximport/inst/doc/tximport.html

Where they generate tx2gene in the following way:

library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
k <- keys(txdb, keytype = "TXNAME")
tx2gene <- select(txdb, k, "GENEID", "TXNAME")


So, I reasoned to do it the same way. But since my data is mouse one, I used a different gene annotation file:

library(TxDb.Mmusculus.UCSC.mm10.knownGene)
txdb <- TxDb.Mmusculus.UCSC.mm10.knownGene
k <- keys(txdb, keytype = "TXNAME")
tx2gene <- select(txdb, k, "GENEID", "TXNAME")


The transcript annotation file that I used when running salmon is gencode.vM13.transcripts.fa.sidx. Then when I try getting txi object:

txi <- tximport(files, type = "salmon", tx2gene = tx2gene)


It raises the error:

Seems like I am creating tx2gene in the wrong way. Maybe I need to use a different library, not TxDb.Mmusculus.UCSC.mm10.knownGene. Any suggestions would be greatly appreciated.

Update

I looked into the quant.sf files that I got from salmon and it looked the following way:

A colleague adviced me to strip away everything that follows the dot in the Name column, so it started to look:

However, still no luck. The identifiers in the k <- keys(txdb, keytype = "TXNAME") look like that:

"uc007afg.1" "uc007afh.1" "uc007afi.2" "uc011wht.1" "uc011whu.1"
"uc057aty.1"


I suppose I need to convert these identifiers first to ENS-like ones, but do not know how to.

## 2 Answers

The solution was to use a different library as I expected. It should be library(TxDb.Hsapiens.UCSC.hg19.ensGene). And also, as specified in the question, to remove everything after the dot in the Name column of the quant.sf files.

Do your ids in the expression file (from gencode) match up with the gene IDs in the transcript file (from UCSC?) I'm willing to bet that they don't. Stay consistent throughout your process. Either pull down the gencode transcript to gene translations, or do your pseudoalignments to UCSC transcripts.

• I already got the salmon aligned data, that was aligned to the gencode file. Now I do not know what TxDb library file I need to use. Apr 10 '18 at 21:56
• see answer here Apr 11 '18 at 10:48