digitalcytometry / cytotrace2

CytoTRACE 2 is an interpretable AI method for predicting cellular potency and absolute developmental potential from scRNA-seq data.
Other
85 stars 6 forks source link

Error in plotData #16

Closed nwhvlewbvuerwv closed 4 months ago

nwhvlewbvuerwv commented 4 months ago

Hi, thanks for the wonderful tool! I met a problem when running the plotData function, and it gives the error saying that:

Error in if (!(max(expression_data) < 20)) { : 
  missing value where TRUE/FALSE needed

However, I didn't even give the expreession_data in the plotData function (I was using a Seurat object).

Here are my codes:

library(CytoTRACE2)
seurat_obj <- readRDS("ifng.rds")
cytotrace2_result <- cytotrace2(seurat_obj, is_seurat = TRUE, species = 'human')
plots <- plotData(cytotrace2_result = cytotrace2_result, 
                  is_seurat = TRUE)

My running information for cytotrace2 was:

cytotrace2: Started loading data
Dataset contains 20472 genes and 6359 cells.
The passed subsample size is greater than the number of cells in dataset.
Now setting subsample size to 6359
cytotrace2: Running on 1 subsample(s) approximately of length 6359
cytotrace2: Started running on subsample(s). This will take a few minutes.
cytotrace2: Started preprocessing.
11919 input genes mapped to model genes.
cytotrace2: Started prediction.
This section will run using  5 / 8 core(s).
cytotrace2: Started postprocessing.
cytotrace2: Running with fast mode (subsamples are processed in parallel)
This section will run on 6 sub-sample(s) of approximately 1060 cells each using 6 / 8 core(s).
  |====================================================================================| 100%
cytotrace2: Finished
nwhvlewbvuerwv commented 4 months ago

Issue solved. I looked for the source code and found that the expression_data came from:

if (is_seurat) {
expression_data <- as.data.frame(GetAssayData(cytotrace2_result, assay="RNA", slot='counts'))

So I got my expression_data out and found that there were some NaN in my data. Then I removed them and the error disappeared.

Thanks again for this excellent tool!