mass2mz: Conversion functions between mass and m/z

Description Usage Arguments Author(s) Examples

View source: R/mass-utility-functions.R

Description

mass2mz and mz2mass allow to convert between (monoisotopic) mass and m/z of specified ion adducts an vice versa. The functions return a list with length equal to x, each element being a numeric with the m/z or mass for the specified adducts. See below for examples.

adducts retrieves the definitions for the supported ion adducts. The function returns a data.frame.

Usage

1
2
3
4
5
mass2mz(x, adduct = adducts())

mz2mass(x, adduct = adducts())

adducts(pattern, polarity, name, set, ...)

Arguments

x

numeric with the masses (or m/z values) to be converted.

adduct

either a data.frame with required columns "name", "nmol" (number of molecules), "charge" (the total charge of the molecule) and "massdiff" (total mass difference), such as returned by the adducts function, or a character with the names of the adducts (see adducts for supported adducts).

pattern

For adducts: optional character(1) specifying a pattern to be used to retrieve selected adducts, e.g. containing a hydrogen.

polarity

For adducts: optional numeric(1) to retrieve only adducts with positive (polarity = 1) or negative (polarity = -1) polarity.

name

For adducts: define the names of the adducts for which the definition should be returned.

set

For adducts: character(1) defining sets of adducts.

...

For adducts: additional parameters to be passed to the grep() function.

Author(s)

Johannes Rainer, Jan Stanstrup

Examples

1
2
3
4
5
masses <- c(75.032028409, 105.042595, 162.115698458, 180.063385)
names(masses) <- c("a", "b", "c", "d")

## Calculate mz for adducts [M+H]+ and [M+Na]+
mzs <- mass2mz(masses, adduct = c("[M+H]+", "[M+Na]+"))

michaelwitting/CompoundDb documentation built on April 29, 2020, 8:42 p.m.