satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.26k stars 906 forks source link

Error in SCTransform on merged Seurat v5 object #8385

Open ctlongg opened 8 months ago

ctlongg commented 8 months ago

Hi,

I am processing an scRNA-seq dataset containing 14 samples. For each sample, I performed the standard QC filtering based on nFeatures and mitochondrial gene percentage, followed by the identification of doublet cells with DoubletFinder. After that, I merged the 14 samples and joined the layers while preserving only the merged counts layer. However, when I try to perform SCTransform on this merged object, I get the error Error in bw.SJ(genes_log_gmean_step1) : need at least 2 data points . I tried looking into the source code of SCTransform but couldn't locate whether something was wrong with my merged object or it was due to an incompatibility issue with Seurat v5. Below is the code for merging and SCTransform, thanks for the help.

data <- readRDS("D:/workspace/scRNA-seq/merged_filtered.RDS")
data <- JoinLayers(data)
data[["RNA"]]$scale.data <- NULL
data[["RNA"]]$data <- NULL
data <- SCTransform(data, vars.to.regress = c("percent.mt"), verbose = FALSE)

Error in bw.SJ(genes_log_gmean_step1) : need at least 2 data points

saketkc commented 8 months ago

Hi @ctlongg, I would need to take a look at the object in this case. Can you email your object to schoudhary@nygenome.org? Thanks!

denvercal1234GitHub commented 1 month ago

Hi @saketkc - I also merge my individual Seurat objects (setting (merge.data=T)) that were SCTranform-ed individually. Do I need to perform SeuratObject::JoinLayers() now before proceeding with setting my variable_features with SelectIntegrationFeatures?

This is because when I did SeuratObject::JoinLayers(Merged_Seurat_Obj) right after merging the different objects, I encountered an error Error in UseMethod(generic = "JoinLayers", object = object) : no applicable method for 'JoinLayers' applied to an object of class "c('SCTAssay', 'Assay', 'KeyMixin')"

Here is my merged object atm:

Screenshot 2024-08-02 at 15 33 47

Thank you for your help.

Related: https://github.com/satijalab/seurat/issues/8558