alignment_score: Alignment Scores for Evaluating the Degree of Mixing Samples

View source: R/alignment_score.R

alignment_scoreR Documentation

Alignment Scores for Evaluating the Degree of Mixing Samples

Description

This function evaluates the degree of mixing samples from different batches in the batch corrected data. It is based on the dissimilarity matrix from Principal Component Analysis.

Usage

alignment_score(
    data,
    batch,
    var = 0.95,
    k = round(0.1 * nrow(data)),
    ncomp = 20
)

Arguments

data

A numeric matrix. Samples are in rows, while variables are in columns. NAs are not allowed.

batch

A factor or a class vector for the batch grouping information (categorical outcome variable). The length should be equal to the number of samples in the data.

var

The proportion of data variance explained by the principal components, ranging from 0 to 1. Default value is 0.95.

k

Integer, the number of nearest neighbours. By default 10% of the number of samples are used.

ncomp

Integer, the number of components for principal component analysis. Default value is 20.

Value

A numeric alignment score that ranges from 0 to 1, representing poor to perfect performance of mixing the samples from different batches.

Author(s)

Yiwen Wang, Kim-Anh LĂȘ Cao

References

\insertRef

butler2018integratingPLSDAbatch

See Also

Scatter_Density, box_plot, density_plot and partVar_plot as the other methods for batch effect detection and batch effect removal assessment.

Examples

library(TreeSummarizedExperiment) # for functions assays(),rowData()
data('sponge_data')
X <- assays(sponge_data)$Clr_value # centered log ratio transformed data
batch <- rowData(sponge_data)$Y.bat # batch information
names(batch) <- rownames(sponge_data)

alignment_score(data = X, batch = batch, var = 0.95, k = 3, ncomp = 20)


EvaYiwenWang/PLSDAbatch documentation built on Sept. 25, 2024, 8:54 p.m.