You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When merging multiple Seurat objects that include assays for RNA, ADT, HTO, and CMO, an issue arises if one object (e.g., NDE005) is missing the CMO assay due to experimental reasons. Upon merging, the layer names for the CMO assay become incorrect, causing a shift in layer labels and barcodes. This misalignment could severely impact downstream analyses, particularly for researchers who have yet to demultiplex their samples after merging. Or did not find a missing assay.
I was merging four Seurat objects, NDE005, NDE010, NDE011, and NDE012, where only NDE005 lacks the CMO assay. After merging, incorrect layer names were observed for the CMO assay:
The layer names should accurately reflect the samples:
There should be counts.NDE012, data.NDE012, and scale.data.NDE012, and no counts.NDE005, data.NDE005, or scale.data.NDE005.
Upon further inspection of the Layers for the CMO assay their data are shifted too:
counts.NDE005 incorrectly contains barcodes from NDE010
It appears everything in that assay got shifted by one Object which I only noticed because I always add a sample ID to the barcodes!
I can easily reproduce the issue and found a temporary workaround by adding a placeholder CMO assay to the NDE005 object before merging
# Create an empty sparse matrix for missing Assay5 before merging the objectsfake_CMO=Matrix::sparseMatrix(i= integer(0),
j= integer(0),
x=numeric(0),
dims= c(length(rownames(NDE012_seuratObj[["CMO"]])),
length(colnames(NDE005_seuratObj))))
# Set row names and column names
rownames(fake_CMO) = rownames(NDE012_seuratObj[["CMO"]])
colnames(fake_CMO) = colnames(NDE005_seuratObj)
NDE005_seuratObj[["CMO"]] = CreateAssay5Object(counts=fake_CMO))
# Bug doesn't occur anymore because all assays types are present in all objects
This bug can mislead researchers into using incorrect data for downstream analysis, particularly affecting sample demultiplexing in my case. Although it occurs in niche cases, a warning or error when merging Seurat objects with mismatched assays would be helpfull.
When merging multiple Seurat objects that include assays for RNA, ADT, HTO, and CMO, an issue arises if one object (e.g., NDE005) is missing the CMO assay due to experimental reasons. Upon merging, the layer names for the CMO assay become incorrect, causing a shift in layer labels and barcodes. This misalignment could severely impact downstream analyses, particularly for researchers who have yet to demultiplex their samples after merging. Or did not find a missing assay.
CODE TO GET THE BUG:
I was merging four Seurat objects, NDE005, NDE010, NDE011, and NDE012, where only NDE005 lacks the CMO assay. After merging, incorrect layer names were observed for the CMO assay:
The layer names should accurately reflect the samples:
Upon further inspection of the Layers for the CMO assay their data are shifted too:
It appears everything in that assay got shifted by one Object which I only noticed because I always add a sample ID to the barcodes!
I can easily reproduce the issue and found a temporary workaround by adding a placeholder CMO assay to the NDE005 object before merging
This bug can mislead researchers into using incorrect data for downstream analysis, particularly affecting sample demultiplexing in my case. Although it occurs in niche cases, a warning or error when merging Seurat objects with mismatched assays would be helpfull.
The text was updated successfully, but these errors were encountered: