percentile_norm: Percentile Normalisation

View source: R/managing_batch_effects.R

percentile_normR Documentation

Percentile Normalisation

Description

This function corrects for batch effects in case-control microbiome studies. Briefly, the relative abundance of microbial variables (i.e. bacterial taxa) in case (i.e. disease) samples are converted to percentiles of the equivalent variables in control (i.e. healthy) samples within a batch prior to pooling data across batches. Pooled batches must have similar case and control cohort definitions.

Usage

percentile_norm(data = data, batch = batch, trt = trt, ctrl.grp)

Arguments

data

A data frame that contains the microbial variables and required to be corrected for batch effects. Samples as rows and variables as columns.

batch

A factor or a class vector for the batch grouping information (categorical outcome variable).

trt

A factor or a class vector for the treatment grouping information (categorical outcome variable).

ctrl.grp

Character, the name of control samples (i.e. healthy).

Value

A data frame that corrected for batch effects.

Author(s)

Yiwen Wang, Kim-Anh LĂȘ Cao

References

\insertRef

gibbons2018correctingPLSDAbatch

See Also

linear_regres and PLSDA_batch as the other methods for batch effect management.

Examples

library(TreeSummarizedExperiment) # for functions assays(),rowData()
data('AD_data')

# centered log ratio transformed data
ad.clr <- assays(AD_data$EgData)$Clr_value
ad.batch <- rowData(AD_data$EgData)$Y.bat # batch information
ad.trt <- rowData(AD_data$EgData)$Y.trt # treatment information
names(ad.batch) <- names(ad.trt) <- rownames(AD_data$EgData)
ad.PN <- percentile_norm(data = ad.clr, batch = ad.batch,
                            trt = ad.trt, ctrl.grp = '0-0.5')


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