Answers.Body: <p>I got exactly the same problem not long ago (see my <a href="https://bioinformatics.stackexchange.com/questions/5531/how-should-i-address-batch-effects-in-my-experiment">other</a> question what I tried to do). We used the same function!</p>
  
  <p>My code ran fine on my HPC but the same code/data failed on my laptop. I later found out I had to upgrade my R to the latest version (3.5.1) and upgrade all my bioconductor packages to the latest. My HPC was on a recent bioconductor docker, so there was no problem.</p>
  
  <p>Please make sure everything in your environment latest (R, R packages, Bioconductor).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T20:16:04.043Z
Answers.Text: Actually I tried updating packages with `update.packages()` function, but it did not help. I already have the latest `R` version `3.5.1`. Then, I reinstalled `tximport`, `DESeq2` and no success either
Answers.UserDisplayName: Nikita Vlasenko
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-04T17:44:26.297Z
Answers.Text: I agree, that was the issue. I was able to solve it though only by reinstalling everything through `bioconda` in a way described in the question I asked later on: https://bioinformatics.stackexchange.com/questions/5538/install-deseq2-through-anaconda .    It is interesting that such an error `invalid rownames length` comes up precisely when packages installation was messed up and it is very misleading. I just got it the second time on a different computer.
Answers.UserDisplayName: Nikita Vlasenko
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T10:10:13.143Z
Answers.LastActivityDate: 2018-11-28T10:10:13.143Z
Answers.UserDisplayName: SmallChess
Answers.Body: <p>The same error occurred to me with <code>DESeq2_1.22.2</code> using <code>R 3.5.0</code>.
  By trial and error, I managed to solve the issue when I updated <code>SummarizedExperiment</code> from <code>1.10.1</code> to <code>1.12.0</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-10T20:00:07.630Z
Answers.LastActivityDate: 2019-04-11T09:37:31.453Z
Answers.LastEditDate: 2019-04-11T09:37:31.453Z
Answers.UserDisplayName: wenching
Body: <p>I am trying to use <code>DESeqDataSetFromTximport</code> function from <code>DESeq2</code> package to construct <code>dds</code> object:</p>
  
  <pre><code>dds &lt;- DESeqDataSetFromTximport(txi, sampleTable, ~Group)
  </code></pre>
  
  <p>And somehow it is giving me the following error:</p>
  
  <blockquote>
    <p>Error in <code>rownames&lt;-</code>(<code>*tmp*</code>, value = c("ENSMUSG00000000001", "ENSMUSG00000000003",  : 
      invalid rownames length</p>
  </blockquote>
  
  <p>I used the same code for other datasets but for the current one it is somehow not working. My <code>sampleTable</code> looks like this:</p>
  
  <pre><code>       ID      Group
  1    de_1 denervated
  2    de_2 denervated
  3    de_3 denervated
  4    de_4 denervated
  5   den_5       sham
  6    ho_1        IgG
  7    ho_2        IgG
  8    ho_3        IgG
  9    sh_1       sham
  10   sh_2       sham
  11   sh_3       sham
  12   sh_4       sham
  13   sh_5       sham
  14 VLA_10  anti-VLA4
  15 VLA_12  anti-VLA4
  16  VLA_7  anti-VLA4
  </code></pre>
  
  <p><code>txi</code> was formed in the following way:</p>
  
  <pre><code>k = keys(txdb, keytype = "GENEID")
  df = AnnotationDbi::select(txdb, keys = k, keytype = "GENEID", columns = "TXNAME")
  tx2gene = df[, 2:1]  # tx ID, then gene ID
  txi &lt;- tximport(names, type = "salmon", tx2gene = tx2gene)
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-28T23:52:22.547Z
Comments.Text: That error message suggests that something is very wrong with `txi` can you post some of its contents and say how you created it?
Comments.UserDisplayName: Devon Ryan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-29T00:46:00.523Z
Comments.Text: The code for `txi` creation is at the very bottom of the last code piece. I created it from the `names` array that is pointing to the relevant `.sf` files. The thing is that everything was working fine and then just suddenly stopped. I suppose some `install.packages()` run just messed up all of the installation. Currently I am having a lot of trouble with reinstalling everything from scratch. I do not know though, whether it will actually fix anything.
Comments.UserDisplayName: Nikita Vlasenko
Tags: <deseq2>
Title: DESeqDataSetFromTximport invalid rownames length
ThreadText: # DESeqDataSetFromTximport invalid rownames length
  
  (Asked by: username_0 on 2018-11-28)
  
  I am trying to use `DESeqDataSetFromTximport` function from `DESeq2` package to construct `dds` object:
  
  ```
  dds <- DESeqDataSetFromTximport(txi, sampleTable, ~Group)
  
  ```
  
  And somehow it is giving me the following error:
  
  > Error in `rownames<-`(`*tmp*`, value = c("ENSMUSG00000000001", "ENSMUSG00000000003", :
  > invalid rownames length
  
  I used the same code for other datasets but for the current one it is somehow not working. My `sampleTable` looks like this:
  
  ```
         ID      Group
  1    de_1 denervated
  2    de_2 denervated
  3    de_3 denervated
  4    de_4 denervated
  5   den_5       sham
  6    ho_1        IgG
  7    ho_2        IgG
  8    ho_3        IgG
  9    sh_1       sham
  10   sh_2       sham
  11   sh_3       sham
  12   sh_4       sham
  13   sh_5       sham
  14 VLA_10  anti-VLA4
  15 VLA_12  anti-VLA4
  16  VLA_7  anti-VLA4
  
  ```
  
  `txi` was formed in the following way:
  
  ```
  k = keys(txdb, keytype = "GENEID")
  df = AnnotationDbi::select(txdb, keys = k, keytype = "GENEID", columns = "TXNAME")
  tx2gene = df[, 2:1]  # tx ID, then gene ID
  txi <- tximport(names, type = "salmon", tx2gene = tx2gene)
  
  ```
  
  Any suggestions would be greatly appreciated
  
  **Tags:** deseq2
  
  > **Comments:**
  > **username_1**: That error message suggests that something is very wrong with `txi` can you post some of its contents and say how you created it?  
  > **username_0**: The code for `txi` creation is at the very bottom of the last code piece. I created it from the `names` array that is pointing to the relevant `.sf` files. The thing is that everything was working fine and then just suddenly stopped. I suppose some `install.packages()` run just messed up all of the installation. Currently I am having a lot of trouble with reinstalling everything from scratch. I do not know though, whether it will actually fix anything.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-11-28. Score: 3 | Accepted answer
  
  I got exactly the same problem not long ago (see my [other](https://bioinformatics.stackexchange.com/questions/5531/how-should-i-address-batch-effects-in-my-experiment) question what I tried to do). We used the same function!
  
  My code ran fine on my HPC but the same code/data failed on my laptop. I later found out I had to upgrade my R to the latest version (3.5.1) and upgrade all my bioconductor packages to the latest. My HPC was on a recent bioconductor docker, so there was no problem.
  
  Please make sure everything in your environment latest (R, R packages, Bioconductor).
  
  > **Comments:**
  > **username_0**: Actually I tried updating packages with `update.packages()` function, but it did not help. I already have the latest `R` version `3.5.1`. Then, I reinstalled `tximport`, `DESeq2` and no success either  
  > **username_0**: I agree, that was the issue. I was able to solve it though only by reinstalling everything through `bioconda` in a way described in the question I asked later on: https://bioinformatics.stackexchange.com/questions/5538/install-deseq2-through-anaconda .    It is interesting that such an error `invalid rownames length` comes up precisely when packages installation was messed up and it is very misleading. I just got it the second time on a different computer.  
  
  ---
  
  ### Answer by username_3 on 2019-04-10. Score: 2
  
  The same error occurred to me with `DESeq2_1.22.2` using `R 3.5.0`.
  By trial and error, I managed to solve the issue when I updated `SummarizedExperiment` from `1.10.1` to `1.12.0`.
  
  
  ---
  
  