pca_bhattacharyya_dist: Bhattacharyya distance between bathces in PCA space

View source: R/batch_correction.R

pca_bhattacharyya_distR Documentation

Bhattacharyya distance between bathces in PCA space

Description

Computes Bhattacharyya distance between all pairs of batches after projecting the samples into PCA space with pcaMethods::pca

Usage

pca_bhattacharyya_dist(
  object,
  batch,
  all_features = FALSE,
  center = TRUE,
  scale = "uv",
  nPcs = 3,
  ...
)

Arguments

object

a MetaboSet object

batch

column name of pData givinh the batch labels

all_features

logical, should all features be used? If FALSE (the default), flagged features are removed before imputation.

center

logical, should the data be centered prior to PCA? (usually yes)

scale

scaling used, as in pcaMethods::prep. Default is "uv" for unit variance

nPcs

the number of principal components to use

...

other parameters to pcaMethods::pca

Value

matrix of Bhattacharyya distances between batches

Examples

# Batch correction
## Not run: 
batch_corrected <- normalize_batches(merged_sample, batch = "Batch", group = "QC", ref_label = "QC")
# Evaluate batch correction
pca_bhattacharyya_dist(merged_sample, batch = "Batch")
pca_bhattacharyya_dist(batch_corrected, batch = "Batch")

## End(Not run)

antonvsdata/notame documentation built on Sept. 14, 2024, 11:09 p.m.