Answers.Body: <p>By setting <code>type="salmon"</code> you're overriding your settings for things like <code>txIdCol</code>. The various <code>type</code> options (except <code>none</code>) are presets to set things correctly for the output from various programs like <code>salmon</code> or <code>kallisto</code>. If you need to specify custom column names, set <code>type="none"</code>.</p>
  
  <p>As an aside, if I'm interpreting your question correctly you have only two samples in total. You can not perform a meaningful analysis with an unreplicated experiment, so if that is indeed your case then don't waste your time further with this dataset.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-03T18:06:59.563Z
Answers.Text: Thank you, that explains it. As for the lack of replicates this is for an undergraduate research project, and we're just trying to get our R code to work until we get actual data.
Answers.UserDisplayName: wolff
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-03T18:19:47.027Z
Answers.Text: Ah download a public dataset and try to reproduce a published analysis with that. If you can set similarish (or better!) results as those published then you're good to go :)
Answers.UserDisplayName: Devon Ryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-03T06:57:58.867Z
Answers.LastActivityDate: 2018-05-03T06:57:58.867Z
Answers.UserDisplayName: Devon Ryan
Body: <p>I'm trying to run a differential expression analysis of 2 samples of the same species, but with different treatments using DESeq2. I'm using Ensembldb to create a tx2gene dataframe for tximport, however tximport does not select the columns I specify, and instead always selects the tx_biotype leading to the following output:</p>
  
  <pre><code>.                    25_quant    28_quant
  nontranslating_CDS    10422.41    10022.74
  protein_coding     22196722.59 24002269.26
  </code></pre>
  
  <p>I'm running tximport using the following params:</p>
  
  <pre><code>txi_tx &lt;- tximport(files, type = "salmon", tx2gene = tx2gene,
                     txIdCol = "tx_id", geneIdCol = "gene_id")
  </code></pre>
  
  <p>I've gotten around this by deleting all columns from my tx2gene DF apart from tx_id and gene_id. However, I think this might be causing problems in the DESeq2 analysis somehow, and I would like to rule out that possibility.</p>
  
  <p>This is what my <code>names(tx2gene)</code> looks like:</p>
  
  <pre><code>"tx_id"            "tx_biotype"       "tx_seq_start"     "tx_seq_end"
  "tx_cds_seq_start" "tx_cds_seq_end"  
  "gene_id"          "tx_name"
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
Tags: <r><ensembl><tximport><tx2gene>
Title: tximport txidcol and geneidcol selecting wrong column
ThreadText: # tximport txidcol and geneidcol selecting wrong column
  
  (Asked by: username_0 on 2018-05-02)
  
  I'm trying to run a differential expression analysis of 2 samples of the same species, but with different treatments using DESeq2. I'm using Ensembldb to create a tx2gene dataframe for tximport, however tximport does not select the columns I specify, and instead always selects the tx\_biotype leading to the following output:
  
  ```
  .                    25_quant    28_quant
  nontranslating_CDS    10422.41    10022.74
  protein_coding     22196722.59 24002269.26
  
  ```
  
  I'm running tximport using the following params:
  
  ```
  txi_tx <- tximport(files, type = "salmon", tx2gene = tx2gene,
                     txIdCol = "tx_id", geneIdCol = "gene_id")
  
  ```
  
  I've gotten around this by deleting all columns from my tx2gene DF apart from tx\_id and gene\_id. However, I think this might be causing problems in the DESeq2 analysis somehow, and I would like to rule out that possibility.
  
  This is what my `names(tx2gene)` looks like:
  
  ```
  "tx_id"            "tx_biotype"       "tx_seq_start"     "tx_seq_end"
  "tx_cds_seq_start" "tx_cds_seq_end"  
  "gene_id"          "tx_name"
  
  ```
  
  What am I doing wrong?
  
  **Tags:** r, ensembl, tximport, tx2gene
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-05-03. Score: 2 | Accepted answer
  
  By setting `type="salmon"` you're overriding your settings for things like `txIdCol`. The various `type` options (except `none`) are presets to set things correctly for the output from various programs like `salmon` or `kallisto`. If you need to specify custom column names, set `type="none"`.
  
  As an aside, if I'm interpreting your question correctly you have only two samples in total. You can not perform a meaningful analysis with an unreplicated experiment, so if that is indeed your case then don't waste your time further with this dataset.
  
  > **Comments:**
  > **username_0**: Thank you, that explains it. As for the lack of replicates this is for an undergraduate research project, and we're just trying to get our R code to work until we get actual data.  
  > **username_1**: Ah download a public dataset and try to reproduce a published analysis with that. If you can set similarish (or better!) results as those published then you're good to go :)  
  
  ---
  
  