cnio-bu / beyondcell

Beyondcell is a computational methodology for identifying tumour cell subpopulations with distinct drug responses in single-cell RNA-seq and Spatial Transcriptomics data.
Other
40 stars 4 forks source link

Test failure: no non-missing arguments to max; returning -Inf #64

Closed SGMartin closed 1 year ago

SGMartin commented 1 year ago
Warning (test-bcScore.R:349): default values
no non-missing arguments to max; returning -Inf
Backtrace:
 1. beyondcell::bcScore(pbmc, gs = ssc, expr.thres = 0)
      at test-bcScore.R:349:2
 3. base::apply(bc@normalized, 1, scales::rescale, to = c(0, 1))
      at beyondcell/R/Score.R:171:2
 5. scales:::rescale.numeric(newX[, i], ...)
 7. base::range(x, na.rm = TRUE, finite = TRUE)
SGMartin commented 1 year ago

The issues lies in the fact that

ssc <- GetCollection(SSc, n.genes = 100, include.pathways = TRUE)

returns a signature sig-20965 whose values cannot be calculated for any cell in PBMC, thus returning NaN. When bcScore tries to center a missing vector, in line 172:

scaled.matrix <- t(apply(bc@normalized, 1, scales::rescale, to = c(0, 1)))

An error is returned.

SGMartin commented 1 year ago

Closed in #77