Learn R Programming

metamorphr (version 0.2.0)

normalize_ref: Normalize intensities across samples using a reference feature

Description

Performs a normalization based on a reference feature, for example an internal standard. Divides the Intensities of all features by the Intensity of the reference feature in that sample and multiplies them with a constant value, making the Intensity of the reference feature the same in each sample.

Usage

normalize_ref(
  data,
  reference_feature,
  identifier_column,
  reference_feature_intensity = 1
)

Value

A tibble with intensities normalized across samples.

Arguments

data

A tidy tibble created by read_featuretable.

reference_feature

An identifier for the reference feature. Must be unique. It is recommended to use the UID.

identifier_column

The column in which to look for the reference feature. It is recommended to use identifier_column = UID

reference_feature_intensity

Either a constant value with which the intensity of each feature is multiplied or a function (e.g., mean, median, min, max). If a function is provided, it will use that function on the Intensities of the reference feature in all samples before normalization and multiply the intensity of each feature with that value after dividing by the Intensity of the reference feature. For example, if reference_feature_intensity = mean, it calculates the mean of the Intensities of the reference features across samples before normalization. It then divides the Intensity of each feature by the Intensity of the reference feature in that sample. Finally, it multiplies each Intensity with the mean of the Intensities of the reference features prior to normalization.

Examples

Run this code
# Divide by the reference feature and make its Intensity 1000 in each sample
toy_metaboscape %>%
  impute_lod() %>%
  normalize_ref(reference_feature = 2, identifier_column = UID, reference_feature_intensity = 1000)

# Divide by the reference feature and make its Intensity the mean of intensities
# of the reference features before normalization
toy_metaboscape %>%
  impute_lod() %>%
  normalize_ref(reference_feature = 2, identifier_column = UID, reference_feature_intensity = mean)

Run the code above in your browser using DataLab