Compute scores based on the k-nearest neighbour batch effect test (kBET).
Accepts a DimReduc instance or a
graph object (Graph or
Neighbor) provided that it
contains distances or connectivities.
If 'what' is a DimReduc
object, a knn graph is computed for k = 50. Then, (or if 'what'
is a Graph or a
Neighbor object), connectivities
are derives from 50 nearest neighbours distances. Finally, the kBET test is
computed for each cell-type label of all provided cell.var. kBET
measures if local batch label distribution is similar to the global one. The
result of kBET is the average test rejection rate (between 0 and 1). The
closest to zero, the less bias is attributable to the batch effect.
Usage
ScoreKBET(
  object,
  batch.var,
  cell.var,
  what,
  graph.type = c("distances", "connectivities"),
  seed.use = 42L,
  verbose = TRUE,
  assay = NULL,
  layer = NULL
)
AddScoreKBET(
  object,
  integration,
  batch.var,
  cell.var,
  what,
  graph.type = c("distances", "connectivities"),
  seed.use = 42L,
  verbose = TRUE,
  assay = NULL,
  layer = NULL
)Arguments
- object
- A Seurat object 
- batch.var
- The name of the batch variable (must be in the object metadata) 
- cell.var
- The name of the column with cell type label variable (must be in the object metadata). If - NULLis passed, the kBET score is computed for all cells at once.
- what
- the name of the dimension reduction or Graph/Neighbor object to score. Must be in the Seurat object. 
- graph.type
- one of 'distances' (default) or 'connectivities', to indicate the type of graph when - whatis not a dimension reduction.
- seed.use
- the value of the seed to obtain reproducible results. - NULLdisables to use of a seed
- verbose
- whether to print progress messages 
- assay
- assay to use. Passed to Seurat to automatically construct the - batch.varwhen not provided (- DefaultAssay()is used by default). Useless otherwise
- layer
- layer to use. Passed to Seurat to automatically construct the - batch.varwhen not provided. Useless otherwise
- integration
- name of the integration to score 
Value
ScoreKBET: a list with one element per cell.var. Each
is a named numeric vector of kBET score (floats between 0 and 1), one per
cell-label.
AddScoreKBET:  the updated Seurat object with the mean kBET
score(s) set for the integration.
References
Büttner, M., Miao, Z., Wolf, F. A., Teichmann, S. A. & Theis, F. J. A test metric for assessing single-cell RNA-seq batch correction. Nat Methods 16, 43–49 (2018). DOI
Luecken, M. D., Büttner, M., Chaichoompu, K., Danese, A., Interlandi, M., Mueller, M. F., Strobl, D. C., Zappia, L., Dugas, M., Colomé-Tatché, M. & Theis, F. J. Benchmarking atlas-level data integration in single-cell genomics. Nat Methods 19, 41–50 (2021). DOI
