satijalab / sctransform

R package for modeling single cell UMI expression data using regularized negative binomial regression
GNU General Public License v3.0
208 stars 33 forks source link

Error in while ((it <- it + 1) < limit && abs(del) > eps) { : missing value where TRUE/FALSE needed #76

Closed nasjr08 closed 3 years ago

nasjr08 commented 3 years ago

I have recently started analysing my sc data and I got this error. I have been following a non-Seurat workflow where instead I use the SingleCellExperiment package to create an sce object (SingleCellExperiment() function) and did some filtering including low library size ,cells, low feature count and high mito percentage. ... I tried using the vst() function for variance stabilizing transformation on the data and got the above error.

The traceback output was:

stop(condition) 10. signalConditions(obj, exclude = getOption("future.relay.immediate", "immediateCondition"), resignal = resignal, ...) 9. signalConditionsASAP(obj, resignal = FALSE, pos = ii) 8. resolve.list(y, result = TRUE, stdout = stdout, signal = signal, force = TRUE) 7. resolve(y, result = TRUE, stdout = stdout, signal = signal, force = TRUE) 6. value.list(fs) 5. value(fs) 4. future_xapply(FUN = FUN, nX = nX, chunk_args = X, args = list(...), get_chunk = [, expr = expr, envir = envir, future.globals = future.globals, future.packages = future.packages, future.scheduling = future.scheduling, future.chunk.size = future.chunk.size, future.stdout = future.stdout, ... 3. future_lapply(X = index_lst, FUN = function(indices) { umi_bin_worker <- umi_bin[indices, , drop = FALSE] if (method == "poisson") { return(fit_poisson(umi = umi_bin_worker, model_str = model_str, ... 2. get_model_pars(genes_step1, bin_size, umi, model_str, cells_step1, method, data_step1, theta_given, theta_estimation_fun, verbosity) 1. sctransform::vst(counts, latent_var = c("log_umi"), return_gene_attr = TRUE, return_cell_attr = TRUE, verbosity = 0)

This was performed on the raw counts prior to any other normalization.

ChristophH commented 3 years ago

Please install the develop version of sctransform and try again remotes::install_github("ChristophH/sctransform@develop"). If you continue to run into this problem, please share a reproducible example, so I can have a look at it. In the meantime you can also try method = 'qpoisson' or method = 'glmGamPoi' in your call to vst().

aheilbut commented 3 years ago

I have run into the same issue (on 0.3, 0.3.1, and on the development version). Strangely (or not), it seems to be dataset dependent. Changing the method to "qpoisson" does seem to work.

ChristophH commented 3 years ago

@aheilbut Could you share a reproducible example, so I can have a look at what the problem is?

nasjr08 commented 3 years ago

Hi Christoph,

Thank you for the recommendations. I ended up not doing an a variance stabilising transformation in my data and di d a different normalization method. However, at the time I did try method = 'qpoisson' and that did work, but I was unsure whether there are any caveats for using this method over the default setting. is anything I need consider prior to applying such a method over normal the normal poisson method?

Cheers, Naseer

jamesc1312 commented 3 years ago

I've tried to install the develop version of sctransform at remotes::install_github("ChristophH/sctransform@develop") but get Error: Failed to install 'sctransform' from GitHub: (converted from warning) installation of package ‘/var/folders/tb/89z033f528xgxz7608qy970m0000gn/T//RtmplcZUQ9/filea3a846c2f4f2/sctransform_0.3.1.9002.tar.gz’ had non-zero exit status

ChristophH commented 3 years ago

@jamesc1312 Please open a new issue and post the full output of the install command

ChristophH commented 3 years ago

@nasjr08 There is nothing wrong with using the qpoisson or glmGamPoi methods. In fact, I would recommend them over the default (poisson) because they are faster. Results are very similar. poisson has remained the default for backwards compatibility.

nasjr08 commented 3 years ago

Thank you @ChristophH, much appreciated.