Open xmliu01 opened 8 months ago
with seurat 5, you need to run JoinLayers
first, like
all <- JoinLayers(all, assay = 'SCT')
with seurat 5, you need to run
JoinLayers
first, likeall <- JoinLayers(all, assay = 'SCT')
Thanks, I tried it, but it not work.
is your assay named SCT, or RNA? you can also just try JoinLayers(all)
@xmliu01 Can you paste your full code here?
Is FindTransferAnchors available supported for SCTransformed, integrated data? Here is a minimally reproducible problem with sample data.
library(Seurat)
library(SeuratData)
library(ggplot2)
panc8 <- LoadData("panc8")
table(panc8$tech)
Reference processing
pancreas.ref <- subset(panc8, tech %in% c("celseq2", "smartseq2"))
pancreas.ref[["RNA"]] <- split(pancreas.ref[["RNA"]], f = pancreas.ref$tech)
## Sctransform normalize
pancreas.ref <- SCTransform(pancreas.ref)
pancreas.ref <- RunPCA(pancreas.ref)
pancreas.ref <- RunUMAP(pancreas.ref, dims = 1:30)
## Plot
options(repr.plot.height = 8, repr.plot.width = 17)
DimPlot(pancreas.ref, reduction = "umap", group.by = c("tech", "celltype"))
# integrate datasets
pancreas.ref <- IntegrateLayers(object = pancreas.ref, method = CCAIntegration, normalization.method = "SCT", verbose = F)
This is what pancreas.ref looks like: An object of class Seurat 55515 features across 4679 samples within 2 assays Active assay: SCT (21152 features, 3000 variable features) 3 layers present: counts, data, scale.data 1 other assay present: RNA 2 dimensional reductions calculated: pca, umap
## Visualize the effect of integration on embedding
pancreas.ref <- RunUMAP(pancreas.ref, dims = 1:30, reduction = "integrated.dr")
DimPlot(pancreas.ref, reduction = "umap", group.by = c("tech", "celltype"))
Looks effectively batch corrected, great.
This is what pancreas.ref looks like:
An object of class Seurat
55515 features across 4679 samples within 2 assays
Active assay: SCT (21152 features, 3000 variable features)
3 layers present: counts, data, scale.data
1 other assay present: RNA
3 dimensional reductions calculated: pca, umap, integrated.dr
And for query processing same thing:
# select two technologies for the query datasets
pancreas.query <- subset(panc8, tech %in% c("fluidigmc1", "celseq"))
# we will use data from 2 technologies for the reference
pancreas.query[["RNA"]] <- split(pancreas.query[["RNA"]], f = pancreas.query$tech)
pancreas.query <- SCTransform(pancreas.query)
This is what query data looks like at this point
An object of class Seurat
55828 features across 1642 samples within 2 assays
Active assay: SCT (21465 features, 3000 variable features)
3 layers present: counts, data, scale.data
1 other assay present: RNA
Then for the part of FindTransferAnchor here are the following code:
pancreas.anchors <- FindTransferAnchors(reference = pancreas.ref,
query = pancreas.query,
normalization.method="SCT",
reference.assay="SCT",
dims = 1:30,
reference.reduction = "pca")
And the error:
Error: Given reference assay (SCT) has 2 reference sct models. Please provide a reference assay with a single reference sct model.
Traceback:
1. FindTransferAnchors(reference = pancreas.ref, query = pancreas.query,
. normalization.method = "SCT", reference.assay = "SCT", dims = 1:30,
. reference.reduction = "pca")
2. ValidateParams_FindTransferAnchors(reference = reference, query = query,
. normalization.method = normalization.method, recompute.residuals = recompute.residuals,
. reference.assay = reference.assay, reference.neighbors = reference.neighbors,
. query.assay = query.assay, reduction = reduction, reference.reduction = reference.reduction,
. project.query = project.query, features = features, scale = scale,
. npcs = npcs, l2.norm = l2.norm, dims = dims, k.anchor = k.anchor,
. k.filter = k.filter, k.score = k.score, max.features = max.features,
. nn.method = nn.method, n.trees = n.trees, eps = eps, approx.pca = approx.pca,
. mapping.score.k = mapping.score.k, verbose = verbose)
3. stop("Given reference assay (", reference.assay, ") has ", reference.model.num,
. " reference sct models. Please provide a reference assay with a ",
. " single reference sct model.", call. = FALSE)
There is the two reference SCTmodels? The SCT assay seems to only indicate one model? If you can identify the issue here, any help would be appreciated...
I have the same problem since I updated Seurat to 5.0.2 Notably there seems to have been a major change with either SCTransform or IntegrateLayers() since the later doesn't generate an "integrated" assay anymore and only a dimensionality reduction "integrated.dr". How does that impact FindTransferAnchors when applying SCT? Similarly since the update, even FindTransferAnchors codes that previously worked using the RNA normalization pipeline now run indefinitely without throwing error. Likewise IntegrateLayers did not generated "integrated" assay in that case. Was that expected from those updates? Could the Seurat team update or verify how the integration process should be done both for SCT and RNA lognorm approach?
Thanks for providing all this detail -- we are currently investigating this problem and hope to have a solution soon.
did someone know how to resolve this issue? I also met it when I tried to use FindTransferAnchors
to integrate spatial data and scRNA data
I have two data sets of single-cell transcriptomes: snrna and sprna, where snrna was obtained under Seurat v4.3 and sprna was obtained under Seurat v5. I use the same code, as shown below.
However, only one SCT model was obtained in Seurat v4.3, while the sprna obtained in Seurat v5 had five SCT models. When I try to compare these two datasets, I get the following error with FindTransferAnchors.
How do I get one SCT model in Seurat v5?