YosefLab/scone

BiocParallel Errors

Opened this issue · 2 comments

Hi! I am trying to run scone() on a very small expression dataset (~2000 genes and 15 cells) to test out my user-defined functions and see the results. I ran into the following error, which I don't know how to resolve:

Error: BiocParallel errors
  element index: 4, 5, 6, 7, 8, 9, ...
  first error: NA/Inf/NaN Expression Values.

The expression data were pre-preprocessed and I removed genes that were not expressed in the cells. My scaling list includes user-defined functions for a few normalization methods (Seurat's simple norm, sctransform's vst(), SCnorm, and scran). The user-defined functions (besides scran) all return the normalized matrices, not scaled. My user-defined functions return normalized matrices when I call them on their own.

This is how I am calling the scone() function:

BiocParallel::register(BiocParallel::SerialParam())
my_scone <- scone(my_scone,
                  scaling=scaling,
                  run=TRUE,
                  eval_kclust = 2:6, 
                  k_ruv = 0,
                  k_qc = 2,
                  return_norm = "in_memory",
                  zero = "postadjust",
                  adjust_bio="no",
                  adjust_batch="no",
                  bpparam = BiocParallel::SerialParam(),
                  verbose = TRUE)

How could I resolve this error? Thank you!

I discovered the error -- it was due to using sctransform's vst() function. It resulted in NA values. I am closing the issue.

I've reopened the issue. I am trying to understand the BiocParallel errors. Scone is able to run for all of my user-defined functions except for sctransform's vst() normalization function.

My user-defined function is below:

SCT_VST_FN <- function(expression_data){
  return(sctransform::vst(expression_data)$y)
}

Below are the messages while running scone():

Negative controls will not be used in evaluation (correlations with negative controls will be returned as NA)
Imputation step...
Scaling step...
Calculating cell attributes from input UMI matrix: log_umi
Variance stabilizing transformation of count matrix of size 706 by 15
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 706 genes, 15 cells
  |===========================================================================================================================================| 100%
Found 84 outliers - those will be ignored in fitting/regularization step

Second step: Get residuals using fitted parameters for 706 genes
  |===========================================================================================================================================| 100%
Calculating gene attributes
Wall clock passed: Time difference of 0.8297551 secs
Computing RUV factors...
Computing factors for evaluation...
Factor adjustment and evaluation...
...including re-zero step...
Processed: none,none,no_uv,no_bio,no_batch
Error: BiocParallel errors
  element index: 2, 3, 4, 5, 6
  first error: NA/Inf/NaN Expression Values.

It seems that scone() breaks after line 570.

Fortunately, the normalization using SCT_VST_FN() returns the normalized matrix, however I don't understand how to fix this issue.