Tests for enrichment of doublets created from each cluster (i.e. cluster's stickiness). Only applicable with >=4 clusters. Note that when applied to an multisample object, this functions assumes that the cluster labels match across samples.
Usage
clusterStickiness(
x,
type = c("quasibinomial", "nbinom", "binomial", "poisson"),
inclDiff = NULL,
verbose = TRUE
)
Arguments
- x
A table of double statistics, or a SingleCellExperiment on which scDblFinder was run using the cluster-based approach.
- type
The type of test to use (quasibinomial recommended).
- inclDiff
Logical; whether to include the difficulty in the model. If NULL, will be used only if there is a significant trend with the enrichment.
- verbose
Logical; whether to print additional running information.
Examples
sce <- mockDoubletSCE(rep(200,5), dbl.rate=0.2)
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...
#> 5 clusters
#> Creating ~500 artificial doublets...
#> Dimensional reduction
#> Evaluating kNN...
#> Training model...
#> iter=0, 40 cells excluded from training.
#> [1] train-logloss:0.483407
#> Will train until train_logloss hasn't improved in 2 rounds.
#>
#> [2] train-logloss:0.367011
#> [3] train-logloss:0.290226
#> [4] train-logloss:0.239844
#> [5] train-logloss:0.205233
#> [6] train-logloss:0.178721
#> [7] train-logloss:0.158414
#> [8] train-logloss:0.143553
#> [9] train-logloss:0.130555
#> [10] train-logloss:0.121255
#> [11] train-logloss:0.111889
#> [12] train-logloss:0.106096
#> [13] train-logloss:0.101165
#> [14] train-logloss:0.097118
#> iter=1, 41 cells excluded from training.
#> [1] train-logloss:0.479777
#> Will train until train_logloss hasn't improved in 2 rounds.
#>
#> [2] train-logloss:0.360963
#> [3] train-logloss:0.283414
#> [4] train-logloss:0.231641
#> [5] train-logloss:0.196290
#> [6] train-logloss:0.170174
#> [7] train-logloss:0.149762
#> [8] train-logloss:0.135257
#> [9] train-logloss:0.122788
#> [10] train-logloss:0.113626
#> [11] train-logloss:0.105343
#> [12] train-logloss:0.097164
#> [13] train-logloss:0.087985
#> iter=2, 37 cells excluded from training.
#> [1] train-logloss:0.478560
#> Will train until train_logloss hasn't improved in 2 rounds.
#>
#> [2] train-logloss:0.358259
#> [3] train-logloss:0.281206
#> [4] train-logloss:0.229549
#> [5] train-logloss:0.192304
#> [6] train-logloss:0.166348
#> [7] train-logloss:0.143987
#> [8] train-logloss:0.129045
#> [9] train-logloss:0.117298
#> [10] train-logloss:0.108595
#> [11] train-logloss:0.101043
#> [12] train-logloss:0.094268
#> [13] train-logloss:0.088426
#> [14] train-logloss:0.084311
#> [15] train-logloss:0.080233
#> [16] train-logloss:0.074582
#> Threshold found:0.618
#> 47 (4%) doublets called
clusterStickiness(sce)
#> Estimate Std. Error t value p.value FDR
#> 4 0.44502070 0.1776299 2.5053260 0.05413636 0.2706818
#> 1 0.38092041 0.1775950 2.1448829 0.08479195 0.3391678
#> 5 -0.62182785 0.3284316 -1.8933253 0.11686013 0.3505804
#> 3 -0.27224554 0.2282615 -1.1926914 0.28649854 0.5729971
#> 2 0.02637134 0.2118960 0.1244542 0.90580434 0.9058043