The SpatialDecon library implements the SpatialDecon algorithm for mixed cell deconvolution in spatial gene expression datasets. (This algorithm also works in bulk expression profiling data.)
MIT License
33
stars
8
forks
source link
Error when running spatialdecon() on COSMx data #43
Error in solve.default(fit$hessian) :
Lapack routine dgesv: system is exactly singular: U[1,1] = 0
In addition: Warning message:
In lognlm.fit3(X = X, y = Y, par = par0, lik = lik, opt = opt, offset = offset, :
Unsuccessful convergence
lung12.expr <- read.delim("Lung12_exprMat_file.csv", sep=",") rownames(lung12.expr) <- paste(lung12.expr$cellID, lung12.expr$fov, sep="") lung12.expr$cell_ID <- NULL lung12.expr$fov <- NULL
Row.sums.expr <- rowSums(lung12.expr) length(which(Row.sums.expr < 20))/nrow(lung12.expr)*100
3.415062
lung12.expr2 <- lung12.expr[-which(Row.sums.expr < 20),]
lung12.expr2f <- lung12.expr2 lung12.expr2n <- lung12.expr2 for(i in 1:ncol(lung12.expr2)){ lung12.expr2f[,i] <- as.factor(lung12.expr2[,i]) lung12.expr2n[,i] <- as.numeric(as.character(lung12.expr2f[,i])) }
Row.sums.expr2 <- rowSums(lung12.expr2n) lung12.scaled.expr <- sweep(lung12.expr2n, 1, Row.sums.expr2, "/")
negnames = c("NegPrb3","NegPrb5","NegPrb6","NegPrb7", "NegPrb8","NegPrb9","NegPrb10","NegPrb11","NegPrb12","NegPrb13","NegPrb14","NegPrb15","NegPrb16","NegPrb17","NegPrb18","NegPrb19","NegPrb20","NegPrb21","NegPrb22","NegPrb23")
Lung12 <- list() Lung12[[1]] <- t(lung12.scaled.expr) Lung12[[2]] <- t(lung12.expr2n) names(Lung12) <- c("normalized", "raw")
Lung12$bg <- derive_GeoMx_background( norm = Lung12$normalized, probepool = rep(1, nrow(Lung12$normalized)), negnames = c("NegPrb3","NegPrb5","NegPrb6","NegPrb7", "NegPrb8","NegPrb9","NegPrb10","NegPrb11","NegPrb12","NegPrb13","NegPrb14","NegPrb15","NegPrb16","NegPrb17","NegPrb18","NegPrb19","NegPrb20","NegPrb21","NegPrb22","NegPrb23") )
res0 <- spatialdecon( norm = Lung12$normalized, bg = Lung12$bg, X = safeTME )
Error in solve.default(fit$hessian) : Lapack routine dgesv: system is exactly singular: U[1,1] = 0 In addition: Warning message: In lognlm.fit3(X = X, y = Y, par = par0, lik = lik, opt = opt, offset = offset, : Unsuccessful convergence
Any idea what is going on here?