Answers.Body: <p>The solution was to use a different library as I expected. It should be <code>library(TxDb.Hsapiens.UCSC.hg19.ensGene)</code>. And also, as specified in the question, to remove everything after the dot in the <code>Name</code> column of the <code>quant.sf</code> files.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-11T21:09:08.857Z
Answers.LastActivityDate: 2018-04-11T21:09:08.857Z
Answers.UserDisplayName: Nikita Vlasenko
Answers.Body: <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-10T21:56:39.240Z
Answers.Text: 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.
Answers.UserDisplayName: Nikita Vlasenko
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-11T10:48:02.547Z
Answers.Text: see answer [here](https://support.bioconductor.org/p/55509)
Answers.UserDisplayName: heathobrien
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-10T21:30:54.183Z
Answers.LastActivityDate: 2018-04-10T21:30:54.183Z
Answers.UserDisplayName: chrisamiller
Body: <p>I am trying to use <code>tximport</code> to get raw count matrices of a bulk RNA-seq sequencing experiment. I followed the tutorial:</p>
  
  <p><a href="https://bioconductor.org/packages/3.7/bioc/vignettes/tximport/inst/doc/tximport.html" rel="nofollow noreferrer">https://bioconductor.org/packages/3.7/bioc/vignettes/tximport/inst/doc/tximport.html</a></p>
  
  <p>Where they generate <code>tx2gene</code> in the following way:</p>
  
  <pre><code>library(TxDb.Hsapiens.UCSC.hg19.knownGene)
  txdb &lt;- TxDb.Hsapiens.UCSC.hg19.knownGene
  k &lt;- keys(txdb, keytype = "TXNAME")
  tx2gene &lt;- select(txdb, k, "GENEID", "TXNAME")
  </code></pre>
  
  <p>So, I reasoned to do it the same way. But since my data is mouse one, I used a different gene annotation file:</p>
  
  <pre><code>library(TxDb.Mmusculus.UCSC.mm10.knownGene)
  txdb &lt;- TxDb.Mmusculus.UCSC.mm10.knownGene
  k &lt;- keys(txdb, keytype = "TXNAME")
  tx2gene &lt;- select(txdb, k, "GENEID", "TXNAME")
  </code></pre>
  
  <p>The transcript annotation file that I used when running <code>salmon</code> is <code>gencode.vM13.transcripts.fa.sidx</code>. Then when I try getting <code>txi</code> object:</p>
  
  <pre><code>txi &lt;- tximport(files, type = "salmon", tx2gene = tx2gene)
  </code></pre>
  
  <p>It raises the error:</p>
  
  <p><a href="https://i.sstatic.net/vCt2U.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vCt2U.png" alt="enter image description here"></a></p>
  
  <p>Seems like I am creating <code>tx2gene</code> in the wrong way. Maybe I need to use a different library, not <code>TxDb.Mmusculus.UCSC.mm10.knownGene</code>. Any suggestions would be greatly appreciated.</p>
  
  <blockquote>
    <p>Update</p>
  </blockquote>
  
  <p>I looked into the <code>quant.sf</code> files that I got from <code>salmon</code> and it looked the following way:</p>
  
  <p><a href="https://i.sstatic.net/LmbuM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LmbuM.png" alt="enter image description here"></a></p>
  
  <p>A colleague adviced me to strip away everything that follows the dot in the <code>Name</code> column, so it started to look:</p>
  
  <p><a href="https://i.sstatic.net/LaSa2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LaSa2.png" alt="enter image description here"></a></p>
  
  <p>However, still no luck. The identifiers in the <code>k &lt;- keys(txdb, keytype = "TXNAME")</code> look like that:</p>
  
  <pre><code>"uc007afg.1" "uc007afh.1" "uc007afi.2" "uc011wht.1" "uc011whu.1" 
  "uc057aty.1"
  </code></pre>
  
  <p>I suppose I need to convert these identifiers first to <code>ENS</code>-like ones, but do not know how to.</p>
  
Tags: <rna-seq><salmon><tximport><tx2gene>
Title: tx2gene file for tximport issue
ThreadText: # tx2gene file for tximport issue
  
  (Asked by: username_0 on 2018-04-10)
  
  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:
  
  [![enter image description here](https://i.sstatic.net/vCt2U.png)](https://i.sstatic.net/vCt2U.png)
  
  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:
  
  [![enter image description here](https://i.sstatic.net/LmbuM.png)](https://i.sstatic.net/LmbuM.png)
  
  A colleague adviced me to strip away everything that follows the dot in the `Name` column, so it started to look:
  
  [![enter image description here](https://i.sstatic.net/LaSa2.png)](https://i.sstatic.net/LaSa2.png)
  
  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.
  
  **Tags:** rna-seq, salmon, tximport, tx2gene
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-04-11. Score: 2 | Accepted answer
  
  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.
  
  
  ---
  
  ### Answer by username_1 on 2018-04-10. Score: 1
  
  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.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_2**: see answer [here](https://support.bioconductor.org/p/55509)  
  
  ---
  
  