Skip to content

Commit

Permalink
add a assertion when ambient pool size is too small
Browse files Browse the repository at this point in the history
  • Loading branch information
an-altosian committed Jan 2, 2025
1 parent ce06250 commit 6d6eef4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion R/emptyDropsCellRanger.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,18 @@ NULL
}

ambient <- logical(length(totals))
ambient[o[min(ind.min, length(totals)):min(ind.max, length(totals))]] <- TRUE
final.ind.min = min(ind.min, length(totals))
final.ind.max = min(ind.max, length(totals))
if ((final.ind.max - final.ind.min) < 100) {
stop(paste0(
"The ambient pool size (",
final.ind.max - final.ind.min + 1,
") is too small; cannot proceed.",
"Please adjust `ind.min` and `ind.max` to increase the size. ",
"One suggestion is to set `ind.min = sum(colSums(m) > N)` and `ind.max = ncol(m)`, ",
"where N is a threshold of UMI count, such as 100, and m is the count matrix."))
}
ambient[o[final.ind.min:final.ind.max]] <- TRUE
ambient.m <- mat[,ambient,drop=FALSE]
ambient.prof <- rowSums(ambient.m)

Expand Down

0 comments on commit 6d6eef4

Please sign in to comment.