save_batch_plots: Save batch correction plots

Description Usage Arguments Examples

View source: R/batch_correction.R

Description

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

1
2
3
save_batch_plots(orig, corrected, file, width = 14, height = 10,
  batch = "Batch", color = "Batch", shape = "QC",
  color_scale = NULL, shape_scale = NULL)

Arguments

orig, corrected

MetaboSet objects before and after batch effect correction

file

path to the PDF file where the plots will be saved

batch, color, shape

column names of pData 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.

Examples

1
2
3
4
5
6
7
8
## Not run: 
# Batch correction
batch_corrected <- normalize_batches(merged_sample, batch = "Batch", group = "QC", ref_label = "QC")
# Plots of each features
save_batch_plots(orig = merged_sample, corrected = batch_corrected,
                 file = "batch_plots.pdf")

## End(Not run)

antonvsdata/amp documentation built on Jan. 8, 2020, 3:15 a.m.