allocatePrecursor2mz {MetCirc} | R Documentation

## allocatePrecursor2mz: Join two data sources

### Description

Allocates precursor ions to candidate m / z values based on minimal distance of m / z and deviance of rt based on an objective function

### Usage

    allocatePrecursor2mz(sd01, sd02, kNN = 10, mzCheck = 1, rtCheck = 30,
         mzVsRTbalance = 10000, splitPattern = "_", splitInd = 2)

### Arguments

`sd01` | is the output of the `XCMS` and `CAMERA` processing and statistical analysis and `XCMS` and `CAMERA` scripts (see Li et al. 2015 and vignette for further information)
`sd02` | `data.frame` with idMS/MS deconvoluted spectra with fragment ions (m/z, retention time, relative intensity in %) and the corresponding peak correlation group of the precursor ion. `sd02` has to have at least four columns: a column 'mz', 'rt', 'intensity' and 'id'
`kNN` | numerical, number of k-nearest neighbours based on deviation from m/z (i.e. the k entries with the smallest deviation)
`mzCheck` | numerical, maximum tolerated distance for m/z (strong criterion here)
`rtCheck` | numerical, maximum tolerated distance for retention time
`mzVsRTbalance` | numerical, multiplicator for mz value before calculating the (euclidean) distance between two peaks, high value means that there is a strong weight on the deviation m/z value
`splitPattern` | character, character vector to use for splitting, see ?strsplit for further information
`splitInd` | numeric, extract precursor mz at position splitInd

### Details

This function combines different data sources. `convertExampleDF` is a `data.frame` which comprises information on a specific metabolite per row stating the average retention time, average m/z, the name of the metabolite, the adduct ion name, the spectrum reference file name and additional information (here: TRIO/LVS). `allocatePrecursor2mz` uses `data.frame`s of the kind of `sd01\_outputXCMS` and `sd02\_deconvoluted` to create a `data.frame` of the kind of `convertExampleDF`. Allocation of precursor ions to candidate m/z values is based on minimal distance of m/z and deviance of retention time based on an objective function. We can specify threshold values for m/z and retention time to be used in `allocatePrecursor2mz`, as well as the number of neighbours based on deviation from m/z values. Also, we can specify the weight to base the selection on the m/z compared to the retention time (`mzVsRTbalance`). This might be useful because m/z values might differ less than the retention time in `sd01\_outputXCMS` and `sd02\_deconvoluted`. Please note, that it might be problematic to compare `sd01\_outputXCMS` and `sd02\_deconvoluted` and allocate precursor ions therefrom, especially when data were acquired under different conditions.

### Value

allocatePrecursor2mz returns a `data.frame` containing average retention time, average mz, metabolite name, adduct ion name, spectrum reference

### Author(s)

Thomas Naake, thomasnaake@googlemail.com

### References

Li et al. (2015): Navigating natural variation in herbivory-induced secondary metabolism in coyote tobacco populations using MS/MS structural analysis. PNAS, 112, E4147–E4155, 10.1073/pnas.1503106112.

### Examples

    data("sd01_outputXCMS", package = "MetCirc")
    data("sd02_deconvoluted", package = "MetCirc")
    data("convertExampleDF", package = "MetCirc")
    allocatePrecursor2mz(sd01 = sd01_outputXCMS, sd02 = sd02_deconvoluted,
         kNN = 10, mzCheck = 1, rtCheck = 30, mzVsRTbalance = 10000, splitPattern = " _ ", splitInd = 2)

[Package MetCirc version 1.10.0 Index]