The function uses the package HarmonizR to correct batch effects in a combined table of multiple experiments.

harmonize.batches(
  DEprot.object,
  batch.column = "batch",
  algorithm = "ComBat",
  ComBat.mode = 1,
  block = NULL,
  cores = 1,
  verbose = TRUE
)

Arguments

DEprot.object

A DEprot object, as generated by load.counts2. Notice that this function works only with "raw" counts.

batch.column

String indicating the name of a column of the metadata table in which are stored the batch IDs. Default: "batch".

algorithm

Adjustment method handed to HarmonizR. Either "ComBat" or "limma" (limma's removeBatchEffect). Default: "ComBat"

ComBat.mode

Chooses the ComBat parameter set. Applied only when algorithm = "ComBat" and ignored under limma. Each number is a combination of ComBat's par.prior (parametric vs. non-parametric empirical priors) and mean.only (adjust the mean alone, or both mean and variance):

  • 1 — parametric priors; adjusts location and scale (par.prior = TRUE, mean.only = FALSE).

  • 2 — parametric priors; adjusts the mean only, variance left as is (par.prior = TRUE, mean.only = TRUE).

  • 3 — non-parametric priors; adjusts location and scale, with no Gaussian assumption on the batch effect but slower to run (par.prior = FALSE, mean.only = FALSE).

  • 4 — non-parametric priors; adjusts the mean only (par.prior = FALSE, mean.only = TRUE).

Default: 1

block

Number of batches grouped together during blocking. Larger blocks yield fewer sub-matrices and cut runtime; NULL disables blocking. Default: NULL.

cores

Numeric value indicating the number of cores to use for the batch correction. Default: 1.

verbose

Logical value indicating whether processing messages should be printed. Default: TRUE.

Value

An object of class DEprot

Author

Sebastian Gregoricchio

Examples

# Add batch column to the DEprot object
dpo = DEprot::test.toolbox$dpo.raw
dpo@metadata$batch = c(rep("A",6), rep("B",6))

# Correct batch effects
dpo <- harmonize.batches(DEprot.object = dpo,
                         batch.column = "batch",
                         cores = 1)
#> Initializing HarmonizR...
#> Reading the files...
#> Preparing...
#> Splitting the data using ComBat adjustment...
#> Found2batches
#> Adjusting for0covariate(s) or covariate level(s)
#> Found32Missing Data Values 
#> Standardizing Data across genes
#> Fitting L/S model and finding priors
#> Finding parametric adjustments
#> Adjusting the Data
#> Rebuilding...
#> Termination.