ComBat_seq {sva}R Documentation

Adjust for batch effects using an empirical Bayes framework in RNA-seq raw counts

Description

ComBat_seq is an improved model from ComBat using negative binomial regression, which specifically targets RNA-Seq count data.

Usage

ComBat_seq(
  counts,
  batch,
  group = NULL,
  covar_mod = NULL,
  full_mod = TRUE,
  shrink = FALSE,
  shrink.disp = FALSE,
  gene.subset.n = NULL
)

Arguments

counts

Raw count matrix from genomic studies (dimensions gene x sample)

batch

Vector / factor for batch

group

Vector / factor for biological condition of interest

covar_mod

Model matrix for multiple covariates to include in linear model (signals from these variables are kept in data after adjustment)

full_mod

Boolean, if TRUE include condition of interest in model

shrink

Boolean, whether to apply shrinkage on parameter estimation

shrink.disp

Boolean, whether to apply shrinkage on dispersion

gene.subset.n

Number of genes to use in empirical Bayes estimation, only useful when shrink = TRUE

Value

data A gene x sample count matrix, adjusted for batch effects.

Examples


count_matrix <- matrix(rnbinom(400, size=10, prob=0.1), nrow=50, ncol=8)
batch <- c(rep(1, 4), rep(2, 4))
group <- rep(c(0,1), 4)

# include condition (group variable)
adjusted_counts <- ComBat_seq(count_matrix, batch=batch, group=group, full_mod=TRUE)

# do not include condition
adjusted_counts <- ComBat_seq(count_matrix, batch=batch, group=NULL, full_mod=FALSE)


[Package sva version 3.40.0 Index]