Skip to contents

Saves plots of each feature showing the effect of batch correction. Plots show QC samples and regular samples inside each batch, plus the batch mean for biological samples and QC samples as a horizontal line. The dashed line represents QC mean, the filled line represents biological sample mean. NOTE: if you change the shape variable, be sure to set a shape scale as well, the default scale only has 2 values, so it can only accomodate 2 shapes.

Usage

save_batch_plots(
  orig,
  corrected,
  file,
  width = 14,
  height = 10,
  batch = "Batch",
  color = "Batch",
  shape = "QC",
  color_scale = getOption("notame.color_scale_dis"),
  shape_scale = scale_shape_manual(values = c(15, 21)),
  assay.type1 = NULL,
  assay.type2 = NULL
)

Arguments

orig, corrected

SummarizedExperiment or MetaboSet objects before and after batch effect correction

file

path to the PDF file where the plots will be saved

width, height

width and height of the plots in inches

batch, color, shape

column names of pheno data for batch labels, and column used for coloring and shaping points (by default batch and QC)

color_scale, shape_scale

scales for color and scale as returned by ggplot functions.

assay.type1

character, assay of orig to be used in case of multiple assays.

assay.type2

character, assay of corrected to be used in case of multiple assays. If corrected is not supplied, this argument selects another assay from orig.

Value

None, the function is invoked for its plot-saving side effect.

Examples

data(example_set)
# Batch correction
replicates <- list(which(example_set$QC == "QC"))
batch_corrected <- ruvs_qc(example_set, replicates = replicates)
# Plots of each feature
save_batch_plots(
  orig = example_set[1:10], corrected = batch_corrected[1:10],
  file = "batch_plots.pdf"
)
#> agg_record_1847801227 
#>                     2