Skip to contents

This function returns a data.frame that ranks the batch corrected data supplied from first to last based on one of the three different metrics, difference in R2m/R2c, coefficient of variation, and median distance of centroids of batch clusters

Usage

rank_becas(
  omicsData_beca_list,
  comparison_method = "r2_diff",
  batch_effect_cname,
  main_effect_cname,
  omicsData_unnormalized = NULL
)

Arguments

omicsData_beca_list

an list containing at least 2 objects of the class 'pepData', 'proData', 'metabData', 'lipidData', or 'nmrData', usually created by as.pepData, as.proData, as.metabData, as.lipidData, or as.nmrData, respectively.

comparison_method

a character string that can take on one of the following three options: r2_diff, cv, or distance_pca corresponding to the metrics difference in R2m/R2c, coefficient of variation, and median distance of centroids of batch clusters respectively

batch_effect_cname

a character string giving the name of the column in f_data of omics objects that contians the batch information

main_effect_cname

a character string giving the name of the column in f_data of omics objects that contians the treatment (main effect) information

omicsData_unnormalized

an object of the class 'pepData', 'proData', 'metabData', 'lipidData', or 'nmrData', usually created by as.pepData, as.proData, as.metabData, as.lipidData, or as.nmrData, respectively containing the unnormalized data (but log2 transformed data), required for the metric difference in R2m/R2c, otherwise this value can be set to the default as NULL

Value

data.frame with each corresponding to a different BECA from omicsData_beca_list as well as a corresponding rank comparing that method with others

Author

Damon Leach

Examples

library(malbacR)
library(pmartR)
data(pmart_amide)
pmart_amide <- group_designation(pmart_amide, main_effects = "group",batch_id= "batch")
pmart_amide_log <- edata_transform(pmart_amide,"log2")
impObj <- imputation(pmart_amide_log)
pmart_amide_imp <- apply_imputation(impObj,pmart_amide_log)
pmart_amide_norm <- normalize_global(pmart_amide_imp, subset_fn = "all", norm_fn = "median",
                                    apply_norm = TRUE, backtransform = TRUE)
pmart_amide_imp_raw <- edata_transform(pmart_amide_imp,"abundance")
pmart_combat <- bc_combat(pmart_amide_norm)
#> Found3batches
#> Adjusting for0covariate(s) or covariate level(s)
#> Standardizing Data across genes
#> Fitting L/S model and finding priors
#> Finding parametric adjustments
#> Adjusting the Data
pmart_serrf <- bc_serrf(pmart_amide_imp_raw,"group","QC","group")
#> Joining with `by = join_by(batch)`
pmart_serrf <- edata_transform(pmart_serrf,"log2")
pmart_power <- bc_power(pmart_amide_imp)
pmart_qcrfsc <- bc_qcrfsc(pmart_amide_imp_raw,qc_cname = "group",qc_val = "QC",
                          order_cname = "Injection_order",group_cname = "group")
pmart_qcrfsc <- edata_transform(pmart_qcrfsc,"log2")
pmart_range <- bc_range(pmart_amide_imp)
becas = list(ComBat = pmart_combat,SERRF = pmart_serrf,Power = pmart_power,
             QCRFSC = pmart_qcrfsc,Range = pmart_range)
r2_diff_ranking = rank_becas(omicsData_beca_list = becas,comparison_method = "r2_diff",
                             omicsData_unnormalized = pmart_amide_log,
                             main_effect_cname = "group",
                            batch_effect_cname = "batch")