DoubletFinder
DoubletFinder copied to clipboard
Error: In function [: "j" must not have duplicated values
When I use 'DoubletFinder' with seurat5 + BPCells, I got the Error:
sweep.res.list_obj <- paramSweep(obj, PCs = 1:40, sct = FALSE) [1] "Creating artificial doublets for pN = 5%" Error: In function [: "j" must not have duplicated values ▆
- └─DoubletFinder::paramSweep(obj, PCs = 1:40, sct = FALSE)
- └─base::lapply(...)
-
└─DoubletFinder (local) FUN(X[[i]], ...)
-
├─data[, real.cells1]
-
└─data[, real.cells1]
-
└─BPCells:::selection_index(j, ncol(x), colnames(x))\
packageVersion('DoubletFinder') [1] ‘2.0.4’ packageVersion('Seurat') [1] ‘5.0.1’ packageVersion('BPCells') [1] ‘0.1.0’
Previous posts have raised similar questions, but ours seems to be different? https://github.com/chris-mcginnis-ucsf/DoubletFinder/issues/161
Although the authors said "DoubletFinder should work with Seurat V5 now", I still cannot use 'DoubletFinder' with seurat5 + BPCells. Is it my problem? Could someone help me, please?
Re-install Double finder its updated >2.0.4 it works well now :) remotes::install_github("chris-mcginnis-ucsf/DoubletFinder")
good luck :)
I'm facing the same issue. I'm using DoubletFinder v2.0.4, BPCells v0.1.0, Seurat v5.0.0, and R 4.3.1. From the error it seems that the issue is that DoubletFinder is trying to subset by a list of cells that contains a single cell multiple times, but BPCells does not allow indexing that way. Seems like this issue might require attention from the DoubletFinder and/or BPCells team.
As a temporary solution, I found that converting your assays to the old versions allows DoubletFinder to work.
obj[["RNA"]] = as(obj[["RNA"]], "Assay")
obj[["SCT"]] = as(obj[["SCT"]], "Assay")
sweep.list = paramSweep(obj, PCs = 1:30, sct = TRUE)
This worked for me as well, but I had to use v3
paramSweep_v3
obj[["RNA"]] = as(obj[["RNA"]], "Assay")
obj[["SCT"]] = as(obj[["SCT"]], "Assay")
sweep.list = paramSweep_v3(obj, PCs = 1:30, sct = TRUE)
New doubletfinder only works for those Seurat V5 objects without BPCell preprocess