seurat
seurat copied to clipboard
Merging: Error in names(model.list) <- all.levels : attempt to set an attribute on NULL
Similar to #8186 which worked but now I am running into an error: I have 2 rounds of QC (identified using RQC and RQC2) and I want to compare a Before and After plot
What I did: Subset the files
h6_RQC <- subset(x = RNA, subset = Clone == "WT" & Cell_Line == "HuES6")
... repeat for all samples
adding metadata
h6_RQC$QC_Run_2 <- "Before"
...
filter/subset
h6_RQC2 <- subset(h6_RQC, subset = nFeature_RNA <1500 & nCount_RNA < 2000 & percent.mt < 25 & nFeature_RNA > 600 & nCount_RNA > 800)
...repeat for all sample
adding info to metadata
h6_RQC2$QC_Run_2 <- "After"
...
Idents(h6_RQC) <- "QC_Run_2"
...
Make cell id unique to merge
h6_RQC2 <- RenameCells(h6_RQC2, add.cell.id="QC2_")
Idents(object = h6_RQC) <- "Run_QC_2"
...
and finally merge:
h6_both <- merge(h6_RQC2, h6_RQC)
But I get this error:
Error:
Error in names(model.list) <- all.levels :
attempt to set an attribute on NULL
I googled and it looks like maybe something in one object doe not exist in another? But I do not understand how this can be since one file is a subset of another.
I am able to use the h6_RQC2
and h6_RQC
files to merge with h6
("parent" file with no filtering).
Can someone suggest a reason why RQC and RQC2 will not merge but will with a third file?
traceback() 5: merge.SCTAssay(x = objects[[idx.x]][[assay]], y = lapply(X = objects[idx.y], FUN = "[[", assay), labels = projects, add.cell.ids = NULL, collapse = collapse, merge.data = merge.data) 4: merge(x = objects[[idx.x]][[assay]], y = lapply(X = objects[idx.y], FUN = "[[", assay), labels = projects, add.cell.ids = NULL, collapse = collapse, merge.data = merge.data) 3: merge.Seurat(h6_RQC2, h6_RQC, merge.data = FALSE) 2: merge(h6_RQC2, h6_RQC, merge.data = FALSE) 1: merge(h6_RQC2, h6_RQC, merge.data = FALSE)
Hi,
Did you run SCTransform when you are generating these objects? It seems that SCTAssay is causing the problem. In addition, what other commands did you run before merging (you used ...
to mask some commands)?
Hello,
Yes, they are SCTransformed.
...
is just used to repeat the same steps eg:
Idents(h6_RQC) <- "QC_Run_2"
...
Is the same as:
Idents(h6_RQC) <- "QC_Run_2"
Idents(h6h1_RQC) <- "QC_Run_2"
Idents(h6h2_RQC) <- "QC_Run_2"
Idents(h6c_RQC) <- "QC_Run_2"
Idents(h6_RQC) <- "QC_Run_2"
Idents(h9h1_RQC) <- "QC_Run_2"
Idents(h9h2_RQC) <- "QC_Run_2"
Idents(h9c_RQC) <- "QC_Run_2"
Hi,
I see. Thank you for the information. Can you quickly check the str([email protected])
and str([email protected])
? Just to make sure the SCTModel.list object exists in both of your Seurat.objects.
Also, can you provide your sessionInfo() ? Are h6_RQC2 and h6_RQC processed with the same version of Seurat?
I also encountered this problem. I checked the Seurat IntegrateData code, and I reinstalled the Seurat package. Since I got the two SeuratObjects from SplitObject() in the previous integration, I dropped obj@assay$integrated in the following analysis, that is, obj@assay$integrated < -NULL. And DefaultAssay(obj) <- "SCT". I don't have this problem when I do the integration again.