correct_data: Correct data using ComBat

View source: R/02_batch_correct.R

correct_dataR Documentation

Correct data using ComBat

Description

Compute the batch correction on the data using the ComBat algorithm. Define a covariate, either as a character vector or name of tibble column. The covariate should preferable be the cell condition types but can be any column that infers heterogeneity in the data. The function assumes that the batch information is in the "batch" column and the data contains a "sample" column with sample information.

Usage

correct_data(
  df,
  label,
  markers = NULL,
  method = c("ComBat", "ComBat_seq"),
  covar = NULL,
  anchor = NULL,
  ref.batch = NULL,
  parametric = TRUE,
  ...
)

Arguments

df

tibble with expression values

label

The cluster or cell type label. Either as a column name or vector.

markers

Markers to normalize. If NULL, markers will be found using the get_markers function.

method

Default: "ComBat". Choose "ComBat" for cytometry data and "ComBat_seq" for bulk RNAseq data.

covar

The covariate ComBat should use. Can be a vector or a column name in the input tibble. If NULL, no covar will be used

anchor

Experimental: A column or vector specifying which samples are replicates and which are not. If specified, this column will be used as a covariate in ComBat. Be aware that it may be confounded with the condition.

ref.batch

Optional. A string of the batch that should be used as the reference for batch adjustments.

parametric

Default: TRUE. If TRUE, the parametric version of ComBat is used. If FALSE, the non-parametric version is used.

...

Additional parameters to pass onto ComBat and ComBat_seq

See Also

Other batch: batch_correct(), create_som(), normalize(), quantile_norm()

Examples

## Not run: 
corrected <- uncorrected %>%
  correct_data(label = labels, covar = "condition")
  
## End(Not run)

biosurf/cyCombine documentation built on May 23, 2024, 4:07 a.m.