annotate_isotope: Annotate Isotopes for a Given Molecular Formula

annotate_isotopeR Documentation

Annotate Isotopes for a Given Molecular Formula

Description

This function identifies isotopic peaks for a given molecular formula and adduct, matching them with observed peaks based on mass-to-charge ratio (m/z) and retention time (RT).

Usage

annotate_isotope(
  formula = "C9H14N2O12P2",
  adduct = "M-H",
  charge = 1,
  mz = 402.9998,
  rt = 823.1462,
  peak.mz,
  peak.rt,
  rt.tol = 5,
  mz.tol = 15,
  max.isotope = 4
)

Arguments

formula

Character. The molecular formula of the compound (e.g., '"C9H14N2O12P2"').

adduct

Character. The adduct ion type (e.g., '"M-H"').

charge

Numeric. The charge state of the ion. Default is '1'.

mz

Numeric. The accurate mass-to-charge ratio (m/z) of the monoisotopic peak.

rt

Numeric. The retention time (RT) of the compound in seconds.

peak.mz

Numeric vector. Observed m/z values of peaks in the dataset.

peak.rt

Numeric vector. Observed retention times (RT) of peaks in the dataset.

rt.tol

Numeric. The retention time tolerance (in seconds) for matching peaks. Default is '5'.

mz.tol

Numeric. The m/z tolerance (in ppm) for matching peaks. Default is '15'.

max.isotope

Numeric. The maximum number of isotopes to consider. Default is '4'.

Details

The function calculates the theoretical isotope distribution using 'Rdisop::getMolecule()' and then matches observed peaks based on m/z and RT tolerances. The function ensures that at least the '[M+1]' isotope is present for a valid match.

Value

A data frame containing:

peakIndex

Index of the matched peak in the dataset.

mzError.ppm

Mass error (in ppm) between the observed and theoretical isotope peak.

isotopes

Label of the identified isotope (e.g., '[M+1]', '[M+2]').

rtError.s

Retention time error (in seconds).

If no isotopic peaks are matched within the given tolerances, the function returns 'NULL'.


tidymass/metpath documentation built on June 1, 2025, 10:05 p.m.