makeRecalibration {RMassBank} | R Documentation

## Recalibrate MS/MS spectra

### Description

Recalibrates MS/MS spectra by building a recalibration curve of the assigned putative fragments of all spectra in `aggregatedSpecs` (measured mass vs. mass of putative associated fragment) and additionally the parent ion peaks.

### Usage

    makeRecalibration(w, mode,
     	recalibrateBy = getOption("RMassBank")$recalibrateBy,
    		recalibrateMS1 = getOption("RMassBank")$recalibrateMS1,
    		recalibrator = getOption("RMassBank")$recalibrator,
    		recalibrateMS1Window = getOption("RMassBank")$recalibrateMS1Window
    		)

     recalibrateSpectra(mode, rawspec = NULL, rc = NULL, rc.ms1=NULL, w = NULL,
    		recalibrateBy = getOption("RMassBank")$recalibrateBy,
    		recalibrateMS1 = getOption("RMassBank")$recalibrateMS1)

     recalibrateSingleSpec(spectrum, rc,
    		recalibrateBy = getOption("RMassBank")$recalibrateBy)

### Arguments

`w` | For `makeRecalibration`: to perform the recalibration with. For `recalibrateSpectra`: the `msmsWorkspace` which contains the recalibration curves (alternatively to specifying `rc, rc.ms1`).
`mode` | `"pH", "pNa", "pM", "mH", "mM", "mFA"` for different ions ([M+H]+, [M+Na]+, [M]+, [M-H]-, [M]-, [M+FA]-).
`recalibrateBy` | Whether recalibration should be done by ppm ("ppm") or by m/z ("mz").
`recalibrateMS1` | Whether MS1 spectra should be recalibrated separately ("separate"), together with MS2 ("common") or not at all ("none"). Usually taken from settings.
`recalibrator` | The recalibrator functions to be used. Refer to `recalibrate` for details. Usually taken from settings.
`recalibrateMS1Window` | Window width to look for MS1 peaks to recalibrate (in ppm).
`spectrum` | For `recalibrateSingleSpec`: a `MSnbase` `Spectrum`-derived object, commonly a `RmbSpectrum2` for MS2 or `Spectrum1` for MS1.
`rawspec` | For `recalibrateSpectra`:an `RmbSpectraSetList` of `RmbSpectraSet` objects , as the `w@spectra` slot from `msmsWorkspace` or any object returned by `findMsMsHR`. If empty, no spectra are recalibrated, but the recalibration curve is returned.
`rc, rc.ms1` | The recalibration curves to be used in the recalibration.

### Details

Note that the actually used recalibration functions are governed by the general MassBank settings (see `recalibrate`).

If a set of acquired LC-MS runs contains spectra for two different ion types (e.g. [M+H]+ and [M+Na]+) which should both be processed by RMassBank, it is necessary to do this in two separate runs. Since it is likely that one ion type will be the vast majority of spectra (e.g. most in [M+H]+ mode), and only few spectra will be present for other specific adducts (e.g. only few [M+Na]+ spectra), it is possible that too few spectra are present to build a good recalibration curve using only e.g. the [M+Na]+ ions. Therefore we recommend, for one set of LC/MS runs, to build the recalibration curve for one ion type (`msmsWorkflow(mode="pH", steps=c(1:8), newRecalibration=TRUE)`) and reuse the same curve for processing different ion types (`msmsWorkflow(mode="pNa", steps=c(1:8), newRecalibration=FALSE)`). This also ensures a consistent recalibration across all spectra of the same batch.

### Value

`makeRecalibration`: a `list(rc, rc.ms1)` with recalibration curves for the MS2 and MS1 spectra.

`recalibrateSpectra`: if `rawspec` is not `NULL`, returns the recalibrated spectra as `RmbSpectraSetList`. All spectra have their mass recalibrated and evaluation data deleted.

`recalibrateSingleSpec`: the recalibrated `Spectrum` (same object, recalibrated masses, evaluation data like assigned formulae etc. deleted).

### Author(s)

Michael Stravs, Eawag <michael.stravs@eawag.ch>

### Examples

    ## Not run:
    			rcCurve <- recalibrateSpectra(w, "pH")
    			w@spectra <- recalibrateSpectra(mode="pH", rawspec=w@spectra, w=myWorkspace)
    			w@spectra <- recalibrateSpectra(mode="pH", rawspec=w@spectra,	rcCurve$rc, rcCurve$rc.ms1)

    ## End(Not run)

[Package RMassBank version 2.14.1 Index]