batch_sil: batch_sil

View source: R/batch_sil.R

batch_silR Documentation

batch_sil

Description

Determine batch/bio effect using the silhouette coefficient (adopted from scone):

Usage

batch_sil(pca.data, batch, nPCs = 3)

Arguments

pca.data

a list as created by prcomp, batch_sil.R needs $x: the principal components (PCs, correctly: the rotated data)

batch

vector with the batch covariate (for each cell)

nPCs

the number of principal components to use (default: 3)

Value

The average silhouette width for all clusters. For batch effect, the smaller the better. For biological effect, the larger the better.

Examples

    testdata <- create_testset_multibatch(n.genes=1000,
                  n.batch=3, plattform='any')
    pca.data <- prcomp(testdata$data, center=TRUE)
    batch.silhouette <- batch_sil(pca.data, testdata$batch)


theislab/kBET documentation built on Jan. 27, 2024, 9:58 p.m.