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
Hello,
I have a list of seurat objects that I read into a list. Then I merge them, split them by experimental condition, perform standard steps but when running the function FindIntegrationAnchors(), I get:
Error in UseMethod(generic = "Assays", object = object) :
no applicable method for 'Assays' applied to an object of class "NULL"
However, I see that the class of the merged object is "RNA", so I don't get why I get class NULL afterwards.
Please help, I have been stacked in this issue for several days.
# Initialize an empty list to store Seurat objects
seurat_list <- future_lapply(file_paths, readRDS)
# Merge the Seurat objects concurrently
merged_obj <- Reduce(merge, seurat_list) # Takes ~20 min
# class(merged_obj) # Seurat
slotNames(merged_obj)
#[1] "assays" "meta.data" "active.assay" "active.ident" "graphs"
#[6] "neighbors" "reductions" "images" "project.name" "misc"
#[11] "version" "commands" "tools"
# > Assays(merged_obj)
# [1] "RNA"
# split the dataset into a list of four seurat objects (C1, C2, C3, C4)
ifnb.list <- SplitObject(merged_obj, split.by = "expCond1") # very fast
# class(ifnb.list) # list
# normalize and identify variable features for each dataset independently
ifnb.list <- lapply(X = ifnb.list, FUN = function(x) {
x <- NormalizeData(x)
x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000)
})
# class(ifnb.list) # list
# select features that are repeatedly variable across datasets for integration run PCA on each
# dataset using these features
features <- SelectIntegrationFeatures(object.list = ifnb.list)
# class(features) # "character"
ifnb.list <- lapply(X = ifnb.list, FUN = function(x) {
x <- ScaleData(x, features = features, verbose = FALSE)
x <- RunPCA(x, features = features, verbose = FALSE)
})
# class(ifnb.list) # list
I don't want to hijack this issue. I'm not expecting a reply to my own issue here. I mainly post here to be notified of replies to the issue reported above, but I thought that maybe the maintainers might be interested in knowing that the issue might affect more than one use case.
Hi - to the original issue, do you run into the same issue when running the vignette with the ifnb dataset, and/or would you be able to create a reproducible example? Could you check the class() of the individual assays before running FindIntegrationAnchors by running class(ifnb.list[1] etc.?
Hello,
I have a list of seurat objects that I read into a list. Then I merge them, split them by experimental condition, perform standard steps but when running the function FindIntegrationAnchors(), I get:
Error in UseMethod(generic = "Assays", object = object) :
no applicable method for 'Assays' applied to an object of class "NULL"
However, I see that the class of the merged object is "RNA", so I don't get why I get class NULL afterwards.
Please help, I have been stacked in this issue for several days.
Below you can see the script
Thank you very much !
library(Seurat)
library(dplyr)
library(ggplot2)
library(SeuratObject)
library(future.apply)
workDir <- "/project/lbarreiro/USERS/lucas/czi/data/scrna/seurat/human_iav_tcruzi"
setwd(workDir)
file_paths <- list.files(workDir, pattern = "^seuratObj4_[1-4]\.rds$", full.names = TRUE)
seurat_list <- future_lapply(file_paths, readRDS)
merged_obj <- Reduce(merge, seurat_list) # Takes ~20 min
slotNames(merged_obj)
ifnb.list <- SplitObject(merged_obj, split.by = "expCond1") # very fast
ifnb.list <- lapply(X = ifnb.list, FUN = function(x) {
x <- NormalizeData(x)
x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000)
})
features <- SelectIntegrationFeatures(object.list = ifnb.list)
# class(features) # "character"
ifnb.list <- lapply(X = ifnb.list, FUN = function(x) {
x <- ScaleData(x, features = features, verbose = FALSE)
x <- RunPCA(x, features = features, verbose = FALSE)
})
# class(ifnb.list) # list
assayNames(ifnb.list)
immune.anchors <- FindIntegrationAnchors(object.list = ifnb.list, anchor.features = features, reduction = "rpca", assay = "RNA", normalization.method = "LogNormalize")
Error in UseMethod(generic = "Assays", object = object) :
no applicable method for 'Assays' applied to an object of class "NULL"
The text was updated successfully, but these errors were encountered: