在进行去批次时报错
#CCA
seurat_merge_v5 <- IntegrateLayers(
object = seurat_pca, method = CCAIntegration,
orig.reduction = "pca", new.reduction = "cca",
verbose = FALSE
)
#报错
Error in UseMethod(generic = "Assays", object = object) :
no applicable method for 'Assays' applied to an object of class "NULL"
Error in UseMethod(generic = "Assays", object = object) : no applicable method for 'Assays' applied to an object of class "NULL"
#harmony
seurat_merge_v5 <- IntegrateLayers(
object = seurat_merge_v5, method = HarmonyIntegration,
orig.reduction = "pca", new.reduction = "harmony",
verbose = FALSE
)
报错:
Error in names(groups) <- "group" : attempt to set an attribute on NULL
解决:
Hello, you likely haven't split your layers before running IntegrateLayers
.
This line, above the section in the tutorial you have linked, is absolutely crucial :
ifnb[["RNA"]] <- split(ifnb[["RNA"]], f = ifnb$stim)
This replaces the SplitObject
function in Seurat v4 integration pipeline. Here the f
parameter needs to be one of the metadata column, it could be orig.ident, condition, treatment etc