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

SCTransform error when using batch or other latent variables #88

Closed kmwinkley closed 3 years ago

kmwinkley commented 3 years ago

When using a batch variable in SCTransform, the error:

Error in is.nan(rel_attr) : default method not implemented for type 'list'

appears. I believe this originates from the "is.nan" line in implemented in utils.R

rel_attr <- cell_attr[, c(latent_var, batch_var, latent_var_nonreg)] if (any(is.na(rel_attr)) || any(is.nan(rel_attr)) || any(is.infinite(rel_attr))) { stop('cell attributes cannot contain any NA, NaN, or infinite values') }

This error is not returned when performing SCTransform normalization on the same data without the batch variable.

ChristophH commented 3 years ago

Thank you for pointing this out. Fixed in the develop branch