ionFormula: Helper Function for 'fitIonInit'

View source: R/rapt_spec.R

ionFormulaR Documentation

Helper Function for fitIonInit

Description

Creates the formulae that get passed to nls

Usage

ionFormula(ions, charge = 1, threshold = 10, peak = "gaussian")

Arguments

ions

Character. Molecular formula formatted in a way that is acceptable to isopattern

charge

Numeric. Charge of ion.

threshold

Numeric. Percentage threshold of isotope relative to highest intensity isotope. Defaults to 10

peak

Character. One of "gaussian" or "emg". Default is peak = "gaussian". See Details.

Details

The fitting peak shape is either a gaussian (peak = "gaussian") or exponentially modified gaussian (peak = "emg"). The "gaussian" peak shape is defined as

rel[i] * λ[ij] * exp(-(mass - m[ij] - mass.shift)^2 / (2 * sd ^2))

where λ[ij] is the intensity of the jth isotope of ions[i] normalized to the most intense isotope of ions[i] and m[ij] is the mass of the jth isotope of ions[i]. The "emg" peak shape is defined as

(rel[i] * λ[ij] * sd / tau) * sqrt(pi/2) * exp(1/2*(sd/tau)^2-(mass-m[j]-mass.shift)/tau) * erfc(sqrt(1/2)*(sd/tau-(mass-m[j]-mass.shift)/sd))

Value

A character string that concatinates all the formulae for the ions and their respetive isotopes, along with a constant noise term.

See Also

fitIonInit, isopattern

Other spectral fitting functions: fitIonInit()


aproudian2/rapt documentation built on Dec. 15, 2022, 4:24 a.m.