Skip to contents

Calculates enrichment in any type of doublet (i.e. specific combination of clusters) over random expectation. Note that when applied to an multisample object, this functions assumes that the cluster labels match across samples.

Usage

doubletPairwiseEnrichment(
  x,
  lower.tail = FALSE,
  sampleWise = FALSE,
  type = c("poisson", "binomial", "nbinom", "chisq"),
  inclDiff = TRUE,
  verbose = TRUE
)

Arguments

x

A table of double statistics, or a SingleCellExperiment on which scDblFinder was run using the cluster-based approach.

lower.tail

Logical; defaults to FALSE to test enrichment (instead of depletion).

sampleWise

Logical; whether to perform tests sample-wise in multi-sample datasets. If FALSE (default), will aggregate counts before testing.

type

Type of test to use.

inclDiff

Logical; whether to regress out any effect of the identification difficulty in calculating expected counts

verbose

Logical; whether to output eventual warnings/notes

Value

A table of significances for each combination.

Examples

sce <- mockDoubletSCE()
sce <- scDblFinder(sce, clusters=TRUE, artificialDoublets=500)
#> Warning: Some cells in `sce` have an extremely low read counts; note that these could trigger errors and might best be filtered out
#> Clustering cells...
#> 4 clusters
#> Creating ~500 artificial doublets...
#> Dimensional reduction
#> Evaluating kNN...
#> Training model...
#> iter=0, 25 cells excluded from training.
#> iter=1, 24 cells excluded from training.
#> iter=2, 28 cells excluded from training.
#> Threshold found:0.382
#> 28 (5.3%) doublets called
doubletPairwiseEnrichment(sce)
#> theta=0.489911932105741
#>   combination log2enrich     p.value         FDR
#> 3         2+3  1.1533823 0.001539602 0.009237609
#> 1         1+2  0.7193062 0.019212144 0.096060720
#> 5         2+4  0.3320288 0.162470410 0.649881642
#> 2         1+3 -2.6180071 1.000000000 1.000000000
#> 4         1+4 -1.3167759 1.000000000 1.000000000
#> 6         3+4 -0.8677415 1.000000000 1.000000000