correct_drift: Correct drift using cubic spline

Description Usage Arguments Details Value See Also Examples

Description

A wrapper function for applying cubic spline drift correction and saving before and after plots

Usage

1
2
3
4
5
correct_drift(object, log_transform = TRUE, spar = NULL,
  spar_lower = 0.5, spar_upper = 1.5, check_quality = FALSE,
  condition = "RSD_r < 0 & D_ratio_r < 0", plotting = FALSE,
  file = NULL, width = 16, height = 8, color = "QC",
  shape = NULL, color_scale = NULL, shape_scale = NULL)

Arguments

object

a MetaboSet object

spar

smoothing parameter

spar_lower, spar_upper

lower and upper limits for the smoothing parameter

condition

a character specifying the condition used to decide whether drift correction works adequately, see Details

plotting

logical, whether plots should be drawn

file

path to the PDF file where the plots should be saved

width, height

width and height of the plots in inches

color

character, name of the column used for coloring the points

shape

character, name of the column used for shape

color_scale

the color scale as returned by a ggplot function

Details

If spar is set to NULL (the default), the smoothing parameter will be separately chosen for each feature from the range [spar_lower, spar_upper] using cross validation. The condition parameter should be a character giving a condition compatible with dplyr::filter. The condition is applied on the changes in the quality metrics RSD, RSD_r, D_ratio and D_ratio_r. For example, the default is "RSD_r < 0 and D_ratio_r < 0", meaning that both RSD_r and D_ratio_r need to decrease in the drift correction, otherwise the drift corrected feature is discarded and the original is retained. If shape is set to NULL (the default), the column used for color is also used for shape

Value

MetaboSet object as the one supplied, with drift corrected features

See Also

dc_cubic_spline, smooth.spline for details about the regression, inspect_dc for analysing the drift correction results, save_dc_plots for plotting the drift correction process for each feature

Examples

1
corrected <- correct_drift(merged_sample)

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