satijalab / sctransform

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

latent variable issues #21

Closed kohlkopf closed 5 years ago

kohlkopf commented 5 years ago

I have a merged Seurat object. Three replicates all processed separately up until SCTransform(). I stored the replicate number as a metadata field in the S4 object. I have tried with the replicate number as an int as well as a factor. When I provide replicate metadata to vars.to.regress make significant progress, but hit a snag at the end:

... Determine variable features Set 3000 variable features Place corrected count matrix in counts slot Regressing out replicate_factor | | 0%Error in qr.resid(qr = qr, y = data.expr[x, ]) : 'qr' and 'y' must have the same number of rows

When I provide replicate to batch_var I also make significant progress, but am halted at an earlier stage:

... Found 67 outliers - those will be ignored in fitting/regularization step

Error in intI(j, n = d[2], dn[[2]], give.dn = FALSE) : 'NA' indices are not (yet?) supported for sparse Matrices

The odd thing is that running this merged object without either of the arguments set completes without issue.

kohlkopf commented 5 years ago

I'd had some sneaky NAs hiding in the metadata column that I didn't detect on first pass. User error!