meichendong / SCDC

SCDC
42 stars 9 forks source link

Fix proportion estimation for NA values #31

Open yoda-vid opened 2 years ago

yoda-vid commented 2 years ago

Thanks for your deconvolution software. I encountered an error during proportion estimation where some NA common genes would be found for some bulk cells. Here is an example stacktrace:

WNNLS Converged at iteration 2
ACACACTTTCTACACG-1_10 has common genes 70 ...
WNNLS Converged at iteration 3
ACACATGATCAAATCT-1_10 has common genes NA ...
ERROR [2022-06-09 15:40:26] NA/NaN/Inf in foreign function call (arg 5)

Compact call stack:
  1 #7: source(parsed$script)
  2 deconvolve_scdc.R#13: tryCatchLog::tryCatchLog({
  3 deconvolve_scdc.R#65: SCDC::SCDC_prop(bulk.eset = eset.integ, sc.eset = eset.ref, sample = "sample", ct.varname = "Class", ct.sub = as.character(unique(eset.ref$Class)))
  4 Deconvolution.R#606: nnls::nnls(A = basis.mvw.temp, b = xbulk.temp)

Error in nnls::nnls(A = basis.mvw.temp, b = xbulk.temp) : 
  NA/NaN/Inf in foreign function call (arg 5)

I was able to work around it by skipping these cells and recording their indices to remove the barcodes. I am not sure if this is the best solution though and wanted to share it here in case it is useful or if there is a better approach.

Might be related to #17, #18.