DoubletFinder icon indicating copy to clipboard operation
DoubletFinder copied to clipboard

Seurat v3/v4 compatibility in new release

Open bobermayer opened this issue 1 year ago • 7 comments

Hi,

is the current release (v2.0.4) not compatible with Seurat v4.4 objects? doubletFinder(seu, PCs = 1:10, pN = 0.25, pK = 0.09, nExp = nExp_poi, reuse.pANN = FALSE, sct = FALSE) gives Error: $ operator not defined for this S4 class while downgrading to v2.0.3 (1b1d4e2) and using doubletFinder_v3 works as expected.

thanks!

bobermayer avatar Nov 23 '23 12:11 bobermayer

My package ‘Seurat’ version 5.0.1, and the version of 'DoubletFinder' is 2.0.4, it can work, maybe you can try this. Below is my code : pbmc <- doubletFinder(pbmc, PCs = 1:10, pN = 0.25, pK = 0.005, nExp = nExp_poi, reuse.pANN = FALSE, sct = FALSE)

Please-help-me-Thanks avatar Nov 27 '23 05:11 Please-help-me-Thanks

I have had the same issue using Seurat_4.3.0 and DoubletFinder_2.0.4. To resolve, I copied the doubletFinder function from the GitHub page and replaced seu@assays$RNA$counts by seu@assays$RNA@counts and that seems to work ... same for the 'paramSweep' function ... hopefully just a syntax issue with Seurat 4?

rocanja avatar Dec 08 '23 12:12 rocanja

please use this code to install 2.0.3:

remotes::install_github('https://github.com/ekernf01/DoubletFinder', force = T)

lancelotzhang0124 avatar Dec 12 '23 18:12 lancelotzhang0124

I have had the same issue using Seurat_4.3.0 with either DoubletFinder_2.0.4. or DoubletFinder_2.0.3.

I have had the same issue using Seurat_4.3.0 and DoubletFinder_2.0.4. To resolve, I copied the doubletFinder function from the GitHub page and replaced seu@assays$RNA$counts by seu@assays$RNA@counts and that seems to work ... same for the 'paramSweep' function ... hopefully just a syntax issue with Seurat 4?

do you mind share the exact part of codes are being replaced?

StumbleMQ avatar Dec 18 '23 10:12 StumbleMQ

I have had the same issue using Seurat_4.3.0 and DoubletFinder_2.0.4. To resolve, I copied the doubletFinder function from the GitHub page and replaced seu@assays$RNA$counts by seu@assays$RNA@counts and that seems to work ... same for the 'paramSweep' function ... hopefully just a syntax issue with Seurat 4?

I follow this and then i get the following error,

"Error in nrow([email protected]) : no slot of name "meta.data" for this object of class "dgCMatrix"

Anyone have any ideas why this is happening and how to fix it? Thanks.

1054574 avatar Jan 18 '24 17:01 1054574

Sorry for this delayed response, I mistook this Email as a commercial. Here are my codes.

#DoubletFinder library(DoubletFinder)

DefaultAssay(Seurat_object) <- "SCT" sweep.res.list <- paramSweep_v3(Seurat_object, PCs = 1:30, sct = T, num.cores = 1) sweep.stats <- summarizeSweep(sweep.res.list, GT = F) bcmvn <- find.pK(sweep.stats) pK_bcmvn <- bcmvn$pK[which.max(bcmvn$BCmetric)] %>% as.character() %>% as.numeric()

pk_bcmvn = 0.24

annotations <- @.***$MainType homotypic.prop <- modelHomotypic(annotations) #DoubletRate = ncol(Seurat_object)7.61e-6 DoubletRate = 0.075 # ~

nExp_poi <- round(DoubletRatelength(Seurat_object$MainType)) #celltype nExp_poi.adj <- round(nExp_poi(1-homotypic.prop))

Seurat_object <- doubletFinder_v3(Seurat_object, PCs = 1:30, pN = 0.25, pK = pK_bcmvn, nExp = nExp_poi, reuse.pANN = FALSE, sct = T) Seurat_object <- doubletFinder_v3(Seurat_object, PCs = 1:30, pN = 0.25, pK = pK_bcmvn, nExp = nExp_poi.adj, reuse.pANN = 'pANN_0.25_0.03_12053', sct = T)

@.[,"DF_hi.lo"] <- @. $DF.classifications_0.25_0.03_8541 @.@.$DF_hi.lo == "Doublet" & @.$DF.classifications_0.25_0.03_8541 == "Singlet")] <- "Doublet-Low Confidience" @.@.$DF_hi.lo == "Doublet")] <- "Doublet-High Confidience" @.$DF_hi.lo) #Doublet-High Confidience Singlet #7929 136602 singlet <- subset(Seurat_object, subset = DF.classifications_0.25_0.03_8541 == "Singlet" | MainType == "Micro")

StumbleMQ @.***>于2023年12月18日 周一18:01写道:

I have had the same issue using Seurat_4.3.0 with either DoubletFinder_2.0.4. or DoubletFinder_2.0.3.

I have had the same issue using Seurat_4.3.0 and DoubletFinder_2.0.4. To resolve, I copied the doubletFinder function from the GitHub page and replaced @.$RNA$counts by @.@.*** and that seems to work ... same for the 'paramSweep' function ... hopefully just a syntax issue with Seurat 4?

do you mind share the code which exact part of codes are being replaced?

— Reply to this email directly, view it on GitHub https://github.com/chris-mcginnis-ucsf/DoubletFinder/issues/175#issuecomment-1859984640, or unsubscribe https://github.com/notifications/unsubscribe-auth/APGE5K4RWQFOX3SFTKCVCTTYKAH7PAVCNFSM6AAAAAA7XXGRK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZHE4DINRUGA . You are receiving this because you commented.Message ID: @.***>

lancelotzhang0124 avatar Jan 21 '24 01:01 lancelotzhang0124

dgCMatrix class object should be your counts, but it seemed that your function accessed meta.data. Please check if you have linked the correct assays.

1054574 @.***> 于2024年1月19日周五 01:23写道:

I have had the same issue using Seurat_4.3.0 and DoubletFinder_2.0.4. To resolve, I copied the doubletFinder function from the GitHub page and replaced @.$RNA$counts by @.@.*** and that seems to work ... same for the 'paramSweep' function ... hopefully just a syntax issue with Seurat 4?

I follow this and then i get the following error,

"Error in @.** @.**>) : no slot of name "meta.data" for this object of class "dgCMatrix"

Anyone have any ideas why this is happening and how to fix it? Thanks.

— Reply to this email directly, view it on GitHub https://github.com/chris-mcginnis-ucsf/DoubletFinder/issues/175#issuecomment-1898907376, or unsubscribe https://github.com/notifications/unsubscribe-auth/APGE5K7GC4XAOABJ6XFTFKTYPFLBJAVCNFSM6AAAAAA7XXGRK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJYHEYDOMZXGY . You are receiving this because you commented.Message ID: @.***>

lancelotzhang0124 avatar Jan 21 '24 01:01 lancelotzhang0124