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 lapply error #141

Closed wma316 closed 2 years ago

wma316 commented 2 years ago

Hi, I have a list of seurat objects that I'm trying to apply SCTransform in this way:

objects.list<-lapply(objects.list,FUN=SCTransform)

This ends up successul and I have a list of SCTransformed objects. However, when I try another list that is subsetted for specific cell types then I get the following error:

_subset.obj.list<-lapply(subset.obj.lis,FUN=SCTransform) Calculating cell attributes from input UMI matrix: log_umi Error in row_gmean(umi, eps = gmeaneps) : matrix x needs to be of class matrix or dgCMatrix

The original list and subsetted list are both 36 different Seurat objects. The SCTransform works on the first 2 subsetted Seurat objects in the list and gives the error on the 3rd object. What could be the problem?

wma316 commented 2 years ago

It seems that the problem was that one of the subsetted object had only 1 cell left. Removing this object from the list solved the issue.