Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in FindTransferAnchors with SCVI Integrated Reference and Query Dataset #9495

Open
sallyseullee-0821 opened this issue Nov 19, 2024 · 0 comments

Comments

@sallyseullee-0821
Copy link

Hi Seurat team,

I am attempting to map a query scRNA-seq dataset (GSE12) with 12 donors onto an existing UMAP generated from a reference dataset (seurat) that has already been integrated using SCVI. However, I encounter the following error when running FindTransferAnchors:

Projecting cell embeddings
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 't': Argument 'dim.' must be an integer vector of length two.

Both datasets have been processed to include only the common genes between them. Below is the code I used:

# Set default assay and ensure alignment of genes
DefaultAssay(seurat) <- "RNA"
common_genes <- intersect(rownames(seurat), rownames(GSE12))
length(common_genes)  # 18831

# Subset reference and query datasets to include only common genes
seurat.ss <- subset(seurat, features = common_genes)
GSE12.ss <- subset(GSE12, features = common_genes)

# Ensure both reference and query have the same gene order
seurat.ss <- seurat.ss[common_genes, ]
GSE12.ss <- GSE12.ss[common_genes, ]

# Modify reference to v5 assay for compatibility
seurat.ss[['RNA']] <- as(object = seurat.ss[["RNA"]], Class = "Assay5")

# Find transfer anchors
anchors <- FindTransferAnchors(
  reference = seurat.ref, 
  query = GSE12.ss, 
  dims = 1:10, 
  reference.reduction = "scvi"
)

Could you please help me identify the root cause of this issue and approaches to solving this? Specifically:
1. Is there an issue with how I am setting up the FindTransferAnchors function, particularly the reference.reduction?
2. Are there additional preprocessing steps required to ensure compatibility between the SCVI-integrated reference and the query dataset?
3. Is it required to convert the reference reduction of SCVI to Assay5 to match the query dataset's data structure? If so, how is this done? 'seurat.ss[['scvi']] <- as(object = seurat.ss[["scvi"]], Class = "Assay5")' results in error: Error in as(object = seurat.ref[["scvi"]], Class = "Assay5") :
no method or default for coercing “DimReduc” to “Assay5”

Any guidance or suggestions would be greatly appreciated! Thank you in advance for your time and help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant