adjust_batch | R Documentation |
adjust_batch
takes as input a feature-by-sample matrix of microbial
abundances, and performs batch effect adjustment given provided batch and
optional covariate variables. It returns the batch-adjusted abundance matrix.
Additional options and parameters can be passed through the control
parameter as a list (see details).
adjust_batch(feature_abd, batch, covariates = NULL, data, control)
feature_abd |
feature-by-sample matrix of abundances (proportions or counts). |
batch |
name of the batch variable. This variable in data should be a factor variable and will be converted to so with a warning if otherwise. |
covariates |
name(s) of covariates to adjust for in the batch correction model. |
data |
data frame of metadata, columns must include batch and covariates (if specified). |
control |
a named list of additional control parameters. See details. |
control
should be provided as a named list of the following components
(can be a subset).
logical. Indicates whether or not a zero-inflated model should be
run. Default to TRUE (zero-inflated model). If set to FALSE then the
correction will be similar to ComBat
as provided in the sva
package.
numeric. Pseudo count to add feature_abd before the methods' log
transformation. Default to NULL
, in which case adjust_batch
will set the pseudo count automatically to half of minimal non-zero values in
feature_abd
.
character. Name for the generated diagnostic figure file. Default to
"adjust_batch_diagnostic.pdf"
. Can be set to NULL
in which
case no output will be generated.
numeric. Convergence threshold for the method's iterative algorithm for shrinking batch effect parameters. Default to 1e-4.
integer. Maximum number of iterations allowed for the method's iterative algorithm. Default to 1000.
logical. Indicates whether or not verbose information will be printed.
a list, with the following components:
feature-by-sample matrix of batch-adjusted abundances, normalized to the same per-sample total abundance as feature_abd.
list of additional control parameters used in the function call.
Siyuan Ma, siyuanma@g.harvard.edu
data("CRC_abd", "CRC_meta")
CRC_abd_adj <- adjust_batch(feature_abd = CRC_abd,
batch = "studyID",
covariates = "study_condition",
data = CRC_meta)$feature_abd_adj
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.