remove_batcheffect: Removing batch effect of two or three expression set

View source: R/remove_batcheffect.R

remove_batcheffectR Documentation

Removing batch effect of two or three expression set

Description

This function is designed to remove batch effects from given expression datasets and visualize the corrected data using principal component analysis (PCA). It takes three expression datasets as input and performs batch effect correction using the "sva::ComBat" or "sva::ComBat_seq" methods. The function then generates PCA plots to compare the data before and after correction. The PCA plots are customized based on the specified parameters like data type, color palette, log transformation, and path for saving the plots.

Usage

remove_batcheffect(
  eset1,
  eset2,
  eset3 = NULL,
  id_type,
  data_type = c("array", "count", "tpm"),
  cols = "normal",
  palette = "jama",
  log2 = TRUE,
  check_eset = TRUE,
  adjust_eset = TRUE,
  repel = FALSE,
  path = "Result_PCA"
)

Arguments

eset1

These are the expression sets for which you want to remove the batch effect.

eset2

These are the expression sets for which you want to remove the batch effect.

eset3

These are the expression sets for which you want to remove the batch effect. Input 'NULL' for eset3 if not available.

id_type

Type of id present in the expression set (like Ensembl ID or Gene Symbol).

data_type

Type of data in the expression set ("array", "count", or "tpm"). Default is "array".

cols

Color scale to use for the PCA plot. Default is 'normal'.

palette

Color palette to use for the plot. Default is 'jama'.

log2

it performs log2 transformation of the data. Defaults to TRUE.

check_eset

Logical, determining whether to check the eset or not. If TRUE, checks for errors in the expression set. Default is TRUE.

adjust_eset

Logical, whether to adjust the expression set by manipulating the features. Default is TRUE.

repel

whether to add labels to the PCA plot. Default is FALSE.

path

Directory where the results should be saved. If it is NULL, results will be saved in a folder "Combat_PCA".

Value

eset after batch correction

Author(s)

Dongqiang Zeng

References

Yuqing Zhang and others, ComBat-seq: batch effect adjustment for RNA-seq count data, NAR Genomics and Bioinformatics, Volume 2, Issue 3, September 2020, lqaa078, https://doi.org/10.1093/nargab/lqaa078

Leek, J. T., Johnson, W. E., Parker, H. S., Jaffe, A. E., & Storey, J. D. (2012). The sva package for removing batch effects and other unwanted variation in high-throughput experiments. Bioinformatics, 28(6), 882-883.

Examples

data("eset_stad", package = "IOBR")
data("eset_blca", package = "IOBR")
# The returned matrix is the count matrix after removing the batches.
eset <- remove_batcheffect(eset_stad, eset_blca, id_type = "ensembl", data_type = "count")

IOBR/IOBR documentation built on May 5, 2024, 2:34 p.m.