batch_correct: Run batch correction on data

View source: R/02_batch_correct.R

batch_correctR Documentation

Run batch correction on data

Description

This is a wrapper function for the cyCombine batch correction workflow. To run the workflow manually, type "batch_correct" to see the source code of this wrapper and follow along or read the vignettes on the GitHub page https://github.com/biosurf/cyCombine.

Usage

batch_correct(
  df,
  label = NULL,
  xdim = 8,
  ydim = 8,
  rlen = 10,
  parametric = TRUE,
  method = c("ComBat", "ComBat_seq"),
  ref.batch = NULL,
  seed = 473,
  covar = NULL,
  anchor = NULL,
  markers = NULL,
  norm_method = "scale",
  ties.method = "average",
  ...
)

Arguments

df

tibble with expression values

label

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

xdim

The x-dimension size of the SOM.

ydim

The y-dimension size of the SOM.

rlen

Number of times the data is presented to the SOM network

parametric

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

method

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

ref.batch

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

seed

The seed to use when creating the SOM.

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.

markers

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

norm_method

Normalization method. Should be either 'rank', 'scale' or 'qnorm'. Default: 'scale'

ties.method

The method to handle ties, when using rank. Default: 'average'. See ?rank for other options.

...

Additional parameters to pass onto ComBat and ComBat_seq

See Also

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

Examples

## Not run: 
corrected <- uncorrected %>%
  batch_correct(markers = markers,
  covar = "condition")
  
## End(Not run)

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