Error in solve.default(t(mod) %*% mod) : Lapack routine dgesv: system is exactly singular: U[4,4] = 0
Entering edit mode
aina.jene ▴ 10
Last seen 4.3 years ago
ISGlobal - Barcelona


I have recently gotten this error message:

Error in solve.default(t(mod) %*% mod) :  Lapack routine dgesv: system is exactly singular: U[4,4] = 0

when trying to estimate the number of surrogate variables.


My data is the next one:

                                      Call Status  race           id
TCGA-2A-A8VL-01A normal  tumor white TCGA-2A-A8VL
TCGA-2A-A8VO-01A normal  tumor white TCGA-2A-A8VO
TCGA-2A-A8VX-01A normal  tumor white TCGA-2A-A8VX
TCGA-2A-A8W3-01A normal  tumor white TCGA-2A-A8W3
TCGA-2A-AAYF-01A normal  tumor white TCGA-2A-AAYF
TCGA-2A-AAYO-01A normal  tumor white TCGA-2A-AAYO


Levels Call: Normal, LOY, XYY

Levels Status: Tumor, Normal

Race: I am selecting just white individuals


And the expression data is:

            TCGA-2A-A8VL-01A TCGA-2A-A8VO-01A TCGA-2A-A8VT-01A TCGA-2A-A8VV-01A
?|100133144               21               20               49               22
?|100134869               18               14               60               17
?|10357                        81               63               95              109
?|10431                    1312              865              583              919
?|155060                    316              379              730              238
?|340602                       1                1                1                3

My script is the next one:

ii <- intersect(colnames(counts.f), rownames(pheno))

pheno <- pheno[ii,]
counts <- counts.f[,ii]

mod <- model.matrix(~Call + Status, data=pheno[ii,])
mod0 <- model.matrix(~1, data=pheno[ii,])

ns <-[,ii], mod, method="be")
svobj <- sva(counts.f[,ii], mod, mod0,
modSv <- cbind(mod, svobj$sv)


When I try function in most of the datasets that I have I get the same error.

I have found these post from few years ago: ComBat_ Error in solve.default(t(design) %*% design): Lapack routine dgesv: system is exactly singular: U[4, 4] = 0

But for what I understand they already know the batch, so they are using the ComBat function. In my case, I am using sva function to estimate batch and other artifacts.


Can you help me find out how can I fix it?

Thank you


Aina Jene



sva R removebatcheffect • 1.4k views
Entering edit mode

Hi Aina, did you find a solution yet? I get the very same error....




Login before adding your answer.

Traffic: 382 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6