satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.26k stars 905 forks source link

Error in creating an anchor between reference and query data #9286

Closed howardhkk123 closed 2 weeks ago

howardhkk123 commented 3 weeks ago

Hi Seurat team,

My name is Howard. I am trying to annotate the cells from smartseq2 scRNA seq data based on the reference ECCITE-seq dataset from Zhang, B., et al. Nat Immunol. 2022. Becasue their ECCITE-seq data didn't have SPCA and wsnn graph, I generated wsnn graph and conducted SPCA for this data first following the guideline in the Vignettes. Follwoing the SPCA, I tried to generate an archor between my query dataset and the ECCITE-seq reference, but I keep getting this error message during archor generation. "Error in slot(object = reference[[reference.assay]], name = "SCTModel.list") : no slot of name "SCTModel.list" for this object of class "Assay""

Could you please help me figure out the problem?

Thanks! Howard

These are my codes.

MY_seuobj <- readRDS("seuobj_SC.rds")
PBMC_ECCITE <- readRDS(file.path(data_path, "PBMC_vaccine_ECCITE_TCR.rds"))
PBMC_ECCITE[["percent.mt"]] <- PercentageFeatureSet(PBMC_ECCITE, pattern = "^MT.")

DefaultAssay(PBMC_ECCITE) <- 'RNA'
PBMC_ECCITE <- SCTransform(PBMC_ECCITE, assay = "RNA", vst.flavor="v2", vars.to.regress = "percent.mt", verbose = FALSE)%>% RunPCA()

DefaultAssay(PBMC_ECCITE) <- 'ADT'
VariableFeatures(PBMC_ECCITE) <- rownames(PBMC_ECCITE[["ADT"]])
PBMC_ECCITE <- NormalizeData(PBMC_ECCITE, normalization.method = 'CLR', margin = 2) %>%
ScaleData() %>% RunPCA(reduction.name = 'apca')

PBMC_ECCITE <- FindMultiModalNeighbors(
PBMC_ECCITE, reduction.list = list("pca", "apca"),
dims.list = list(1:30, 1:18), modality.weight.name = "RNA.weight"
)
PBMC_ECCITE <- RunUMAP(PBMC_ECCITE, nn.name = "weighted.nn", reduction.name = "wnn.umap", reduction.key = "wnnUMAP_")
PBMC_ECCITE <- RunSPCA(PBMC_ECCITE, graph = 'wsnn', verbose = FALSE)
Anchors <- FindTransferAnchors(
reference = PBMC_ECCITE,
query = MY_seuobj,
normalization.method = "SCT",
k.anchor = 5,
reference.reduction = "spca",
dims = 1:40)

Session info: Seurat 5.0.0 Package info: sctransform 0.4.1