Skip to content

Commit a2fe8ab

Browse files
Refactor doublet rate handling in scDblFinder to streamline logic and improve readability
1 parent ee1d883 commit a2fe8ab

File tree

1 file changed

+10
-12
lines changed
  • modules/local/doublet_detection/scdblfinder/templates

1 file changed

+10
-12
lines changed

modules/local/doublet_detection/scdblfinder/templates/scdblfinder.R

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,19 @@ dbr <- suppressWarnings(as.numeric(dbr_raw))
2323
# Run scDblFinder on the counts matrix (first assay)
2424
# scDblFinder creates artificial doublets internally and returns a new SCE
2525
set.seed(123)
26-
if (!is.na(dbr)) {
27-
message(paste0("Using provided doublet_rate (dbr): ", dbr))
28-
sce <- scDblFinder(
29-
assays(sce)[[1]],
30-
BPPARAM = bp,
31-
dbr = dbr
32-
)
33-
} else {
26+
if (is.na(dbr)) {
3427
message("No valid doublet_rate provided; using scDblFinder internal dbr estimation")
35-
sce <- scDblFinder(
36-
assays(sce)[[1]],
37-
BPPARAM = bp
38-
)
28+
dbr <- NULL
29+
} else {
30+
message(paste0("Using provided doublet_rate (dbr): ", dbr))
3931
}
4032

33+
sce <- scDblFinder(
34+
assays(sce)[[1]],
35+
BPPARAM = bp,
36+
dbr = dbr
37+
)
38+
4139
# Generate a summary table
4240
message("scDblFinder results summary:")
4341
print(table(sce\$scDblFinder.class))

0 commit comments

Comments
 (0)