Nanostring-Biostats / SpatialDecon

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

deconvolute bulk RNAseq data #34

Open caylamason opened 2 years ago

caylamason commented 2 years ago

Hello, I am using SpatialDecon to deconvolute bulk RNA seq data. I'm using log2-transformed and normalized counts for the norm matrix and creating a custom cell profile matrix. I originally tried using a background matrix of zeros but received the error Error in solve.default(fit$hessian): Lapack routine dgesv: system is exactly singular: U[1,1] = 0. Changing the background matrix to 0.1 circumvented the previous error but now produces the following:

Warning message in log(drop(X %% est.b) + offset): “NaNs produced” Warning message in lognlm.fit3(X = X, y = Y, par = par0, lik = lik, opt = opt, offset = offset, : “Unsuccessful convergence” Error in [<-(`tmp*`, name, cellnames, value = 1): subscript out of bounds Traceback:

  1. spatialdecon(norm = norm, raw = raw, bg = bg, X = custom_mtx_seurat, . cellmerges = cellmerges, wts = wts)
  2. convertCellTypes(beta = res$beta, matching = cellmerges, stat = sum, . na.rm = FALSE, sigma = res$sigmas)

What do you recommend using for a background matrix for bulk RNA seq data? Or perhaps that is not where the error stem from? Any help is much appreciated.

Thank you, Cayla

maddygriz commented 2 years ago

Hi Cayla,

This package was not created for bulk RNA seq data so there might be some unforseen issues just due to the type of data you are working with. Aside from that, 0.1 is the background value that I would recommend but the algorithm is expecting linear values, not log2. The values are logged in the algorithm, so the double logging of values might explain the NaNs produced.

Maddy