seurat icon indicating copy to clipboard operation
seurat copied to clipboard

Seurat V2 ScaleData error:Error in if (class(x = data.use) == "dgCMatrix" | class(x = data.use) == : the condition has length > 1

Open leeson89 opened this issue 1 year ago • 4 comments

PBMC <- ScaleData(object = PBMC, vars.to.regress = c('nUMI_raw'), model.use = 'linear', use.umi = FALSE) NormalizeData has not been run, therefore ScaleData is running on non-normalized values. Recommended workflow is to run NormalizeData first. ScaleData is running on non-normalized values. Recommended workflow is to run NormalizeData first. Regressing out: nUMI_raw |=======================================================================================| 100% Time Elapsed: 3.84120058218638 mins Scaling data matrix | | 0% Error in if (class(x = data.use) == "dgCMatrix" | class(x = data.use) == : the condition has length > 1

how to fix it, thank you.

leeson89 avatar Aug 30 '23 07:08 leeson89

closing as duplicate #7742

samuel-marsh avatar Aug 30 '23 14:08 samuel-marsh

sorry closing first and reopening here as more informative error message.

samuel-marsh avatar Aug 30 '23 14:08 samuel-marsh

Hi,

Not member of dev team but hopefully can be helpful. Can you provide the full code you are running up to the point where error occurs and the output of sessionInfo()?

Thanks! Sam

samuel-marsh avatar Aug 30 '23 14:08 samuel-marsh

Hi,

Not member of dev team but hopefully can be helpful. Can you provide the full code you are running up to the point where error occurs and the output of sessionInfo()?

Thanks! Sam

Hi Sam,

I have this problem too. Is it related to the Rcpp package dependency? Because Seurat V2 is 6 years old. I cannot perform the ScaleData function normally. error output:

pbmc <- ScaleData(object = pbmc, vars.to.regress = c("nUMI")) Regressing out: nUMI |======================================================================| 100% Time Elapsed: 24.5039319992065 secs Scaling data matrix | | 0%Error in if (class(x = data.use) == "dgCMatrix" | class(x = data.use) == : the condition has length > 1

Best, Mingxuan

LiangMingxuan00 avatar Apr 24 '24 08:04 LiangMingxuan00

Hi,

This is a very old Seurat object so it likely does not work with our current Seurat codebase. Can you please update try running UpdateSeuratObject() on your object, or re-make the object from the counts matrix? Thanks and sorry for our slow response.

mhkowalski avatar Jun 24 '24 16:06 mhkowalski