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, 17 cells excluded from training.
#> iter=1, 17 cells excluded from training.
#> iter=2, 17 cells excluded from training.
#> Threshold found:0.814
#> 17 (3.2%) doublets called
doubletPairwiseEnrichment(sce)
#> theta=0.0982616714523507
#>   combination  log2enrich      p.value          FDR
#> 3         2+3  1.50334955 0.0001418108 0.0008508647
#> 5         2+4  0.09494413 0.2175146578 1.0000000000
#> 1         1+2  0.20678984 0.2466576257 1.0000000000
#> 2         1+3 -2.02625514 1.0000000000 1.0000000000
#> 4         1+4 -0.97004127 1.0000000000 1.0000000000
#> 6         3+4 -0.60094404 1.0000000000 1.0000000000