satijalab / seurat

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

Issues when merging Seurat objects in Seurat V5 #8469

Open MinxiaoYang opened 7 months ago

MinxiaoYang commented 7 months ago

I was trying to merge multiple Seurat objects but saw the error: Error in validObject(object = x) : invalid class "Assay5" object: Layers must be two-dimensional objects

the codes for merging is listed below: AT1_Cells <- subset(x = AT1LUAD_BatchCombined, subset = (predicted.celltype_level2 == "AT1")) AT2_Cells <- subset(x = AT1LUAD_BatchCombined, subset = (predicted.celltype_level2 == "AT2")) AT1AT2_Cells <- subset(x = AT1LUAD_BatchCombined, subset = (predicted.celltype_level2 == "AT1/AT2")) AECs_3 <- merge(AT1_Cells, y = c(AT2_Cells, AT1AT2_Cells), add.cell.ids = c("AT1", "AT2", "AT1/AT2"), project = "AT1LUAD")

Can anyone provide suggestions, thoughts or solutions? Much appreciated!

cjhong commented 6 months ago

I have the same issue. Any update?

mhkowalski commented 6 months ago

Hi,

Thanks for reporting this. For anyone encountering this issue, are any of these objects that you are going to merge only 1 cell? It would be helpful if you could provide a reproducible example (i.e. with pbmc_small or an object in SeuratData).

cjhong commented 6 months ago

I didn't pay attention to the new data structure ('layers') and followed the instructions at https://satijalab.org/seurat/articles/seurat5_integration. It works now.

MinxiaoYang commented 4 months ago

I have the same issue. Any update?

It functions well when I convert a v5 assay to a v3 assay. pbmc3k[["RNA"]] <- as(object = pbmc3k[["RNA"]], Class = "Assay")

MinxiaoYang commented 4 months ago

Hi,

Thanks for reporting this. For anyone encountering this issue, are any of these objects that you are going to merge only 1 cell? It would be helpful if you could provide a reproducible example (i.e. with pbmc_small or an object in SeuratData).

It functions well when I convert a v5 assay to a v3 assay. pbmc3k[["RNA"]] <- as(object = pbmc3k[["RNA"]], Class = "Assay")