Normalize spectral data to a common scale using several different methods.

normSpectra(
  dat,
  mass_dat,
  method = NULL,
  norm_mz = NULL,
  upper = NULL,
  lower = NULL,
  spectra_cols = NULL,
  showHI = FALSE
)

Arguments

dat

The name of the spectral data frame, containing m/z data in the first column and spectral intensity data in subsequent columns.

mass_dat

A character string; the name of the column in dat containing the m/z data for the spectrum.

method

A character string; the normalization method that should be used to process the data. See 'Methods' below for list of methods. Default = NULL.

norm_mz

Numeric. If method = "custom", the m/z peak to which the spectral intensity should be normalized to. Value should have the same number of decimal places as the m/z data in dat. If method = "custom_imprecise", this value must be given as a character string of numbers.

upper

Numeric. If method = "stdev", the upper m/z bound of the noise region of the spectrum.

lower

Numeric. If method = "stdev", the lower m/z bound of the noise region of the spectrum.

spectra_cols

A character vector; the names of the column in dat containing the intensity data for the spectra-of-interest.

showHI

Logical. To be used with method = "custom". If TRUE, intensity values greater than norm_mz will be kept. If FALSE, any peaks with intensity greater than norm_mz will be truncated to the intensity of norm_mz. Default = FALSE.

Value

Returns a new data frame including the original m/z data and normalized intensity data.

Methods

max

Normalizes the intensity data of spectra to a scale of 0,1.

max_set

Normalizes the intensity data of spectra to a scale of 0,1, where 1 is the single most intense peak of the spectral set.

custom

Normalizes the intensity data of each input spectrum to the intensity of the selected m/z peak.

custom_imprecise

Normalizes the intensity data of each input spectrum to the intensity of the selected m/z peak. Allows for less precise normalization; if data contains four decimal places, input m/z values can be input to 2 or 3 decimal places.

TIC

Evaluates the sum of all intensities (TIC) of each spectrum in a dataset. If the TIC of all spectra are not equal, their intensities are multiplied by a normalization factor.

rel_TIC

Evaluates the sum of all intensities (TIC) of each spectrum in a dataset. If the TIC of all spectra are not equal, their intensities are multiplied by a normalization factor. Each peak intensity is then divided by the normalized peak intensity so that each spectrum in the dataset has a TIC of 1.

RMS

Normalizes each spectrum by dividing each intensity by the spectrum's RMS.

median

Evaluates the median of each spectrum in a dataset after removing 0 values introduced by mapping. If the medians are not equal between spectra, a normalization factor is applied to the spectral intensities until all median intensities in the dataset are equal.

stdev

Evaluates the standard deviation of intensity values within the same noisy region (a region lacking peaks) of each spectrum. All intensities in each spectrum are then divided by the spectrum's standard deviation in the noise region. All output spectra should have a standard deviation of 1 in the selected region.

quantile

Normalizes the distributions of the values in each spectrum in a set. Sorts the intensity data of each spectrum and evaluates the average intensity for each rank. The intensity values are then replaces with the averaged intensities, rearranged in their original order.

References

https://github.com/wesleyburr/subMaldi

Author

Kristen Yeh <kristenyeh@trentu.ca> Wesley Burr <wesleyburr@trentu.ca> Sophie Castel <sophie.castel@ontariotechu.net>

Examples

## Load sample dataset "Master2.rda" data("Master2") ## Normalize spectrum "Before1" to its maximum intensity ex <- normSpectra(dat = Master2, mass_dat = "full_mz", method = "max", spectra_cols = "Before1") ## Normalize the spectra "Before1" and "Before2" to the TIC ex <- normSpectra(dat = Master2, mass_dat = "full_mz", method = "TIC", spectra_cols = c("Before1", "Before2")) ## Normalize spectrum "After1" to the intensity of the peak at m/z 253.22 ex <- normSpectra(dat = Master2, mass_dat = "full_mz", method = "custom", norm_mz = 253.22, spectra_cols = "After1")