satijalab / azimuth

A Shiny web app for mapping datasets using Seurat v4
https://satijalab.org/azimuth
GNU General Public License v3.0
108 stars 31 forks source link

AzimuthReference error: refAssay (SCT) should contain a single SCT model #207

Open erzakiev opened 8 months ago

erzakiev commented 8 months ago

Reprex:

obj <- LoadData("pbmcsca")
obj[["RNA"]] <- split(obj[["RNA"]], f = obj$orig.ident)
options(future.globals.maxSize = 3e+09)
obj <- SCTransform(obj)
obj <- RunPCA(obj, npcs = 30, verbose = F)
obj <- IntegrateLayers(
  object = obj,
  method = RPCAIntegration,
  normalization.method = "SCT",
  verbose = F
)
obj <- FindNeighbors(obj, dims = 1:30, reduction = "integrated.dr")
obj <- RunUMAP(obj, dims = 1:30, return.model = T)

If we check the obj structure, we will see that the IntegrateLayers function didn't add the 'integrated' assay to obj, which is already alarming:

> obj
An object of class Seurat 
56793 features across 31021 samples within 2 assays 
Active assay: SCT (23099 features, 3000 variable features)
 3 layers present: counts, data, scale.data
 1 other assay present: RNA
 3 dimensional reductions calculated: pca, integrated.dr, umap

Instead, the SCT slot contains two SCTmodel(s), and I don't know how to join them, to be honest.

> obj@assays$SCT
SCTAssay data with 23099 features for 31021 cells, and 2 SCTModel(s) 
Top 10 variable features:
 LYZ, S100A8, S100A9, IGKC, RP11-1143G9.4, CH507-513H4.3, IGLC2, PPBP, GNLY, IGLC3 

The problem arises when we want to generate Azimuth reference from this integrated object:

obj_Azimuth <- AzimuthReference(
+   object = obj,
+   refUMAP = "umap",
+   refDR = "pca",
+   refAssay = "SCT",
+   metadata = 'CellType',
+   dims = 1:50,
+   k.param = 31,
+   reference.version = "1.0.0"
+ )
Error in AzimuthReference(object = obj, refUMAP = "umap", refDR = "pca",  : 
  refAssay (SCT) should contain a single SCT model.
In addition: Warning message:
CellType is not a factor. Converting to factor with alphabetical levels.