Question: R Deseq2 Error: Inv(): Matrix Appears To Be Singular
gravatar for komal.rathi
4.9 years ago by
Children's Hospital of Philadelphia, Philadelphia, PA
komal.rathi3.4k wrote:

Hi everyone,

I am trying to use DESeq2 to perform differential gene expression on my HTSeq count data.


 > dim(countData) #my count data
 [1] 13875    64

 > head(countData)
                   C00060 C00079 C00135 C00150 C00154
ENSG00000005206.12    721    759    966    375    285
ENSG00000006062.9     542    442    735    238    552
ENSG00000012171.13    635    352    813    316    391
ENSG00000031544.10      7      3     14      2      0
ENSG00000034063.9      21      8     34     77     68
ENSG00000049319.2       0      1      3      1      0

 #create an object of type DESeqDataSet, make design taking into consideration the age, status, gender and site.
 > dds <- DESeqDataSetFromMatrix(countData = countData,
                          colData = colData,
                          design = ~0+status+age+gender+site) 

 > colData(dds)$status <- factor(colData(dds)$status,

 > summary(colData) #this is how colData looks. There are 64 samples, 3 different disease states : NF, DCM & ISCH.
 sample_name  status    age             gender      site   
 C00060 : 1   DCM :22   Min.   :21.00   Female:32   Cleveland:24  
 C00079 : 1   ISCH:20   1st Qu.:48.00   Male  :32   Penn     :40  
 C00135 : 1   NF  :22   Median :56.00                             
 C00150 : 1             Mean   :51.97                             
 C00154 : 1             3rd Qu.:58.00                             
 C00176 : 1             Max.   :67.00                             

 # running DESeq() gives an error
 > dds <- DESeq(dds,betaPrior=F)
 estimating size factors
 estimating dispersions
 gene-wise dispersion estimates

 Error: inv(): matrix appears to be singular

This is my R sessioninfo()

R version 3.0.1 (2013-05-16)
Platform: x86_64-pc-linux-gnu (64-bit)

[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
[6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=C                 LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] limma_3.18.13           DESeq2_1.2.10           RcppArmadillo_0.4.200.0 Rcpp_0.11.1             GenomicRanges_1.14.4    XVector_0.2.0          
[7] IRanges_1.20.7          BiocGenerics_0.8.0      BiocInstaller_1.12.0   

loaded via a namespace (and not attached):
[1] annotate_1.40.1      AnnotationDbi_1.24.0 Biobase_2.22.0       DBI_0.2-7            genefilter_1.44.0    grid_3.0.1           lattice_0.20-15     
[8] locfit_1.5-9.1       RColorBrewer_1.0-5   RSQLite_0.11.4       splines_3.0.1        stats4_3.0.1         survival_2.37-7      tools_3.0.1         
[15] XML_3.98-1.1         xtable_1.7-3

I am using DESeq2 version 1.2.10 and I found this thread which says upgrade DESeq2 version to 1.3.48 I don't know if it is something to do with the package upgrade or my code. But if it is something to do with the package upgrade, I couldn't find DESeq2 version 1.3.48 so I am unable to upgrade DESeq2. Any help would be appreciated.


R • 2.9k views
ADD COMMENTlink written 4.9 years ago by komal.rathi3.4k

This sounds almost identical to the issue that you linked to that Michael committed a fix toward. One other thing to try would be to not remove the intercept (i.e., design = ~status+age+gender+site). Given the paramaterization you've chosen, you'll want to keep the intercept anyway.

ADD REPLYlink modified 4.9 years ago • written 4.9 years ago by Devon Ryan88k

Yes I tried both ways keeping it and without it, gives me the error anyway. How do I upgrade DESeq2 when there is no update available for it.

ADD REPLYlink written 4.9 years ago by komal.rathi3.4k

The devel branch (Bioconductor 2.14) is currently at version 1.3.76, which contains the fix, so you could switch over to that if you really want. However, I think the next version of Bioconductor is scheduled to be released by Monday (the 14th) anyway, so you might do yourself a favour and just wait until then to upgrade.

ADD REPLYlink modified 4.9 years ago • written 4.9 years ago by Devon Ryan88k

Thank you for the suggestion! I will re-run my analysis on Monday and if everything goes smoothly, I will post it as an answer below.

ADD REPLYlink written 4.9 years ago by komal.rathi3.4k

Let me know if you continue to see this with v1.4. thanks.

ADD REPLYlink written 4.8 years ago by Michael Love1.7k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1279 users visited in the last hour