doubletThresholding {scDblFinder}R Documentation

doubletThresholding

Description

Sets the doublet scores threshold; typically called by scDblFinder.

Usage

doubletThresholding(scores, celltypes, clusters = NULL, dbr = 0.025,
  dbr.sd = 0.02, prop.fullyRandom = 0, do.plot = TRUE)

Arguments

scores

A vector of the doublet score for each cell (real and artificial); can be anything ranging from 0 to 1, with higher scores indicating higher change of being a doublet.

celltypes

A vector of the same length as 'scores' indicating, for each cell, whether it is a 'real' cell or an 'artificial' doublet. Missing values not allowed.

clusters

Optional vector of cluster assignment for each (real) cell, used for homotypic doublet correction.

dbr

The expected (mean) doublet rate.

dbr.sd

The standard deviation of the doublet rate, representing the uncertainty in the estimate.

prop.fullyRandom

The proportion of artificical doublets that are fully random, used for homotypy correction. Default 0.25 (the default value in 'getArtificialDoublets'). Ignored if 'clusters=NULL'

do.plot

Logical; whether to plot the thresholding data (default TRUE).

Value

A scaler indicating the decided threshold.

Examples

# random data
m <- t(sapply( seq(from=0, to=5, length.out=50), 
               FUN=function(x) rpois(30,x) ) )
# generate doublets and merge them with real cells
doublets <- getArtificialDoublets(m, 30)
celltypes <- rep(c("real","artificial"), c(ncol(m), ncol(doublets)))
m <- cbind(m,doublets)
# dummy doublet scores:
scores <- abs(jitter(1:ncol(m),amount=10))
scores <- scores/max(scores)
# get threshold
doubletThresholding(scores, celltypes, do.plot=FALSE)


[Package scDblFinder version 1.1.8 Index]