DoubletFinder icon indicating copy to clipboard operation
DoubletFinder copied to clipboard

Error: In function [: "j" must not have duplicated values

Open alasaa opened this issue 1 year ago • 4 comments

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 ▆

  1. └─DoubletFinder::paramSweep(obj, PCs = 1:40, sct = FALSE)
  2. └─base::lapply(...)
  3. └─DoubletFinder (local) FUN(X[[i]], ...)
    
  4.   ├─data[, real.cells1]
    
  5.   └─data[, real.cells1]
    
  6.     └─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?

alasaa avatar Dec 25 '23 02:12 alasaa

Re-install Double finder its updated >2.0.4 it works well now :) remotes::install_github("chris-mcginnis-ucsf/DoubletFinder")

good luck :)

veeramv avatar Jan 11 '24 10:01 veeramv

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)

ggruenhagen3 avatar Feb 21 '24 16:02 ggruenhagen3

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)

nitinmahajan20 avatar Mar 28 '24 22:03 nitinmahajan20

New doubletfinder only works for those Seurat V5 objects without BPCell preprocess

Pentayouth avatar May 25 '24 09:05 Pentayouth