Learn R Programming

metamorphr (version 0.2.0)

normalize_cyclic_loess: Normalize intensities across samples using cyclic LOESS normalization

Description

The steps the algorithm takes are the following:

  1. log2 transform the intensities

  2. Choose 2 samples to generate an MA-plot from

  3. Fit a LOESS curve

  4. Subtract half of the difference between the predicted value and the true value from the intensity of sample 1 and add the same amount to the intensity of Sample 2

  5. Repeat for all unique combinations of samples

  6. Repeat all steps until the model converges or n_iter is reached.

Convergence is assumed if the confidence intervals of all LOESS smooths include the 0 line. If fixed_iter = TRUE, the algorithm will perform exactly n_iter iterations. If fixed_iter = FALSE, the algorithm will perform a maximum of n_iter iterations.

See the reference section for details.

Usage

normalize_cyclic_loess(
  data,
  n_iter = 3,
  fixed_iter = TRUE,
  loess_span = 0.7,
  level = 0.95,
  verbose = FALSE,
  ...
)

Value

A tibble with intensities normalized across samples.

Arguments

data

A tidy tibble created by read_featuretable.

n_iter

The number of iterations to perform. If fixed_iter = TRUE exactly n_iter will be performed. If fixed_iter = FALSE a maximum of n_iter will be performed and the algorithm will stop whether convergence is reached or not.

fixed_iter

Should a fixed number of iterations be performed?

loess_span

The span of the LOESS fit. A larger span produces a smoother line.

level

The confidence level for the convergence criterion. Note that a a larger confidence level produces larger confidence intervals and therefore the algorithm stops earlier.

verbose

TRUE or FALSE. Should messages be printed to the console?

...

Arguments passed onto loess. For example, degree = 1, family = "symmetric", iterations = 4, surface = "direct" produces a LOWESS fit.

References

  • B. M. Bolstad, R. A. Irizarry, M. Åstrand, T. P. Speed, Bioinformatics 2003, 19, 185–193, DOI 10.1093/bioinformatics/19.2.185.

  • Karla Ballman, Diane Grill, Ann Oberg, Terry Therneau, “Faster cyclic loess: normalizing DNA arrays via linear models” can be found under https://www.mayo.edu/research/documents/biostat-68pdf/doc-10027897, 2004.

  • K. V. Ballman, D. E. Grill, A. L. Oberg, T. M. Therneau, Bioinformatics 2004, 20, 2778–2786, DOI 10.1093/bioinformatics/bth327.

Examples

Run this code
toy_metaboscape %>%
  impute_lod() %>%
  normalize_cyclic_loess()

Run the code above in your browser using DataLab