Answers.Body: <p>One way to see the interaction effect would be including it in the design matrix as explained in the <a href="https://bioconductor.org/packages/release/bioc/vignettes/limma/inst/doc/usersguide.pdf" rel="nofollow noreferrer">limma tutorial</a>. Something on the line of:</p>
  
  <pre><code>design_full &lt;- model.matrix(~ treatment*strain, data = samples(d))
  </code></pre>
  
  <p>Or you could build it yourself in a matrix like</p>
  
  <pre><code> (Intercept) strainA_treatmentA strainA_treatmentB  strainB_treatmentA strainB_treatmentB
         1                      0                  1                  0                   0
         1                      1                  0                  0                   0
  </code></pre>
  
  <p>About the error, it seems like the data is not in the right format, you have either <code>NA</code> or <code>Inf</code> somewhere in the matrix. Check it and rethink the processing you made. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-15T22:19:01.873Z
Answers.LastActivityDate: 2018-03-15T22:19:01.873Z
Answers.UserDisplayName: llrs
Body: <p>I am trying to use DRIMseq for DTU with 2 treatments on two different strains of mice. In my previous analysis with genes only, I had found a strong interaction effect  of strain and treatments. Is it possible to model that with DRIMseq? </p>
  
  <p>Also when I try to add strain term and use it as the batch effect as described in the tutorial, I get the following error:</p>
  
  <pre><code>! Using a subset of 0.1 genes to estimate common precision !
  Error in optimHess(par = par, fn = dm_lik_regG, gr = dm_score_regG, x = x,  : 
    non-finite value supplied by optim
  In addition: There were 50 or more warnings (use warnings() to see the first 50)
  </code></pre>
  
  <p>Please see the sessionInfo() below.</p>
  
  <pre><code>R version 3.4.0 (2017-04-21)
  Platform: x86_64-redhat-linux-gnu (64-bit)
  Running under: CentOS Linux 7 (Core)
  
  Matrix products: default
  BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
  
  locale:
   [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_US.UTF-8   
   [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
  [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
  
  attached base packages:
  [1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
   [1] DRIMSeq_1.6.0                            pheatmap_1.0.8                           ggplot2_2.2.1                           
   [4] edgeR_3.16.5                             limma_3.30.13                            TxDb.Mmusculus.UCSC.mm10.knownGene_3.4.0
   [7] GenomicFeatures_1.26.4                   AnnotationDbi_1.36.2                     Biobase_2.34.0                          
  [10] GenomicRanges_1.26.4                     GenomeInfoDb_1.10.3                      IRanges_2.8.2                           
  [13] S4Vectors_0.12.2                         BiocGenerics_0.20.0                      tximport_1.2.0                          
  
  loaded via a namespace (and not attached):
   [1] Rcpp_0.12.12               RColorBrewer_1.1-2         plyr_1.8.4                 pillar_1.2.1               compiler_3.4.0            
   [6] XVector_0.14.1             bitops_1.0-6               tools_3.4.0                zlibbioc_1.20.0            biomaRt_2.30.0            
  [11] digest_0.6.12              bit_1.1-12                 gtable_0.2.0               RSQLite_2.0                memoise_1.1.0             
  [16] tibble_1.4.2               lattice_0.20-35            pkgconfig_2.0.1            rlang_0.2.0                Matrix_1.2-10             
  [21] DBI_0.7                    stringr_1.3.0              rtracklayer_1.34.2         Biostrings_2.42.1          locfit_1.5-9.1            
  [26] bit64_0.9-7                grid_3.4.0                 XML_3.98-1.10              BiocParallel_1.8.2         magrittr_1.5              
  [31] reshape2_1.4.3             blob_1.1.0                 MASS_7.3-47                scales_0.5.0               Rsamtools_1.26.2          
  [36] GenomicAlignments_1.10.1   SummarizedExperiment_1.4.0 colorspace_1.3-2           labeling_0.3               stringi_1.1.7             
  [41] lazyeval_0.2.1             munsell_0.4.3              RCurl_1.95-4.10           
  </code></pre>
  
Tags: <differential-expression>
Title: Can I use DRIMseq to model interaction effect of variables?
ThreadText: # Can I use DRIMseq to model interaction effect of variables?
  
  (Asked by: username_0 on 2018-03-15)
  
  I am trying to use DRIMseq for DTU with 2 treatments on two different strains of mice. In my previous analysis with genes only, I had found a strong interaction effect of strain and treatments. Is it possible to model that with DRIMseq?
  
  Also when I try to add strain term and use it as the batch effect as described in the tutorial, I get the following error:
  
  ```
  ! Using a subset of 0.1 genes to estimate common precision !
  Error in optimHess(par = par, fn = dm_lik_regG, gr = dm_score_regG, x = x,  : 
    non-finite value supplied by optim
  In addition: There were 50 or more warnings (use warnings() to see the first 50)
  
  ```
  
  Please see the sessionInfo() below.
  
  ```
  R version 3.4.0 (2017-04-21)
  Platform: x86_64-redhat-linux-gnu (64-bit)
  Running under: CentOS Linux 7 (Core)
  
  Matrix products: default
  BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
  
  locale:
   [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_US.UTF-8   
   [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
  [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
  
  attached base packages:
  [1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
   [1] DRIMSeq_1.6.0                            pheatmap_1.0.8                           ggplot2_2.2.1                           
   [4] edgeR_3.16.5                             limma_3.30.13                            TxDb.Mmusculus.UCSC.mm10.knownGene_3.4.0
   [7] GenomicFeatures_1.26.4                   AnnotationDbi_1.36.2                     Biobase_2.34.0                          
  [10] GenomicRanges_1.26.4                     GenomeInfoDb_1.10.3                      IRanges_2.8.2                           
  [13] S4Vectors_0.12.2                         BiocGenerics_0.20.0                      tximport_1.2.0                          
  
  loaded via a namespace (and not attached):
   [1] Rcpp_0.12.12               RColorBrewer_1.1-2         plyr_1.8.4                 pillar_1.2.1               compiler_3.4.0            
   [6] XVector_0.14.1             bitops_1.0-6               tools_3.4.0                zlibbioc_1.20.0            biomaRt_2.30.0            
  [11] digest_0.6.12              bit_1.1-12                 gtable_0.2.0               RSQLite_2.0                memoise_1.1.0             
  [16] tibble_1.4.2               lattice_0.20-35            pkgconfig_2.0.1            rlang_0.2.0                Matrix_1.2-10             
  [21] DBI_0.7                    stringr_1.3.0              rtracklayer_1.34.2         Biostrings_2.42.1          locfit_1.5-9.1            
  [26] bit64_0.9-7                grid_3.4.0                 XML_3.98-1.10              BiocParallel_1.8.2         magrittr_1.5              
  [31] reshape2_1.4.3             blob_1.1.0                 MASS_7.3-47                scales_0.5.0               Rsamtools_1.26.2          
  [36] GenomicAlignments_1.10.1   SummarizedExperiment_1.4.0 colorspace_1.3-2           labeling_0.3               stringi_1.1.7             
  [41] lazyeval_0.2.1             munsell_0.4.3              RCurl_1.95-4.10           
  
  ```
  
  **Tags:** differential-expression
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-15. Score: 2
  
  One way to see the interaction effect would be including it in the design matrix as explained in the [limma tutorial](https://bioconductor.org/packages/release/bioc/vignettes/limma/inst/doc/usersguide.pdf). Something on the line of:
  
  ```
  design_full <- model.matrix(~ treatment*strain, data = samples(d))
  
  ```
  
  Or you could build it yourself in a matrix like
  
  ```
   (Intercept) strainA_treatmentA strainA_treatmentB  strainB_treatmentA strainB_treatmentB
         1                      0                  1                  0                   0
         1                      1                  0                  0                   0
  
  ```
  
  About the error, it seems like the data is not in the right format, you have either `NA` or `Inf` somewhere in the matrix. Check it and rethink the processing you made.
  
  
  ---
  
  