findMsMsHR {RMassBank} | R Documentation

## Extract MS/MS spectra for specified precursor

### Description

Extracts MS/MS spectra from LC-MS raw data for a specified precursor, specified either via the RMassBank compound list (see `loadList`) or via a mass.

### Usage

    findMsMsHR(fileName = NULL, msRaw = NULL, cpdID, mode = "pH",
      confirmMode = 0, useRtLimit = TRUE,
      ppmFine = getOption("RMassBank")$findMsMsRawSettings$ppmFine,
      mzCoarse = getOption("RMassBank")$findMsMsRawSettings$mzCoarse,
      fillPrecursorScan = getOption("RMassBank")$findMsMsRawSettings$fillPrecursorScan,
      rtMargin = getOption("RMassBank")$rtMargin,
      deprofile = getOption("RMassBank")$deprofile, headerCache = NULL,
      peaksCache = NULL, retrieval = "standard")

    findMsMsHR.mass(msRaw, mz, limit.coarse, limit.fine, rtLimits = NA,
      maxCount = NA, headerCache = NULL, fillPrecursorScan = FALSE,
      deprofile = getOption("RMassBank")$deprofile, peaksCache = NULL,
      cpdID = NA)

### Arguments

`fileName` | The file to open and search the MS2 spectrum in.
`msRaw` | The opened raw file (mzR file handle) to search the MS2 spectrum in. Specify either this or `fileName`.
`cpdID` | The compound ID in the compound list (see `loadList`) to use for formula lookup. Note: In \codefindMsMsHR.mass, this is entirely optional and used only in case a warning must be displayed; compound lookup is done via mass only.
`mode` | The processing mode (determines which ion/adduct is searched): `"pH", "pNa", "pM", "pNH4", "mH", "mM", "mFA"` for different ions ([M+H]+, [M+Na]+, [M]+, [M+NH4]+, [M-H]-, [M]-, [M+FA]-).
`confirmMode` | Whether to use the highest-intensity precursor (=0), second- highest (=1), third-highest (=2)...
`useRtLimit` | Whether to respect retention time limits from the compound list.
`ppmFine` | The limit in ppm to use for fine limit (see below) calculation.
`mzCoarse` | The coarse limit to use for locating potential MS2 scans: this tolerance is used when finding scans with a suitable precursor ion value.
`fillPrecursorScan` | If `TRUE`, the precursor scan will be filled from MS1 data. To be used for data where the precursor scan is not stored in the raw data.
`rtMargin` | The retention time tolerance to use.
`deprofile` | Whether deprofiling should take place, and what method should be used (cf. `deprofile`)
`headerCache` | If present, the complete `mzR::header(msRaw)`. Passing this value is useful if spectra for multiple compounds should be extracted from the same mzML file, since it avoids getting the data freshly from `msRaw` for every compound.
`peaksCache` | If present, the complete output of `mzR::peaks(msRaw)`. This speeds up the lookup if multiple compounds should be searched in the same file.
`retrieval` | A value that determines whether the files should be handled either as "standard", if the compoundlist is complete, "tentative", if at least a formula is present or "unknown" if the only know thing is the m/z
`mz` | The mass to use for spectrum search.
`limit.coarse` | Parameter in `findMsMsHR.mass` corresponding to `mzCoarse`. (The parameters are distinct to clearly conceptually distinguish findMsMsHR.mass (a standalone useful function) from the cpdID based functions (workflow functions).)
`limit.fine` | The fine limit to use for locating MS2 scans: this tolerance is used when locating an appropriate analyte peak in the MS1 precursor spectrum.
`rtLimits` | `c(min, max)`: Minimum and maximum retention time to use when locating the MS2 scans.
`maxCount` | The maximal number of spectra groups to return. One spectra group consists of all data-dependent scans from the same precursor whose precursor mass matches the specified search mass.

### Details

Different versions of the function get the data from different sources. Note that findMsMsHR and findMsMsHR.direct differ mainly in that findMsMsHR opens a file whereas findMsMs.direct uses an open file handle - both are intended to be used in a full process which involves compound lists etc. In contrast, findMsMsHR.mass is a low-level function which uses the mass directly for lookup and is intended for use as a standalone function in unrelated applications.

### Value

An `RmbSpectraSet` (for `findMsMsHR`). Contains parent MS1 spectrum (`@parent`), a block of dependent MS2 spectra ((`@children`) and some metadata (`id`,`mz`,`name`,`mode` in which the spectrum was acquired.

For `findMsMsHR.mass`: a list of `RmbSpectraSet`s as defined above, sorted by decreasing precursor intensity.

### Functions

- `findMsMsHR.mass`: A submethod of find MsMsHR that retrieves basic spectrum data

### Note

`findMsMs.direct` is deactivated

### Author(s)

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

### See Also

findEIC

### Examples

    ## Not run:
    			loadList("mycompoundlist.csv")
    			# if Atrazine has compound ID 1:
    			msms_atrazine <- findMsMsHR(fileName = "Atrazine_0001_pos.mzML", cpdID = 1, mode = "pH")
    			# Or alternatively:
    			msRaw <- openMSfile("Atrazine_0001_pos.mzML")
    			msms_atrazine <- findMsMsHR(msRaw=msRaw, cpdID = 1, mode = "pH")
    			# Or directly by mass (this will return a list of spectra sets):
    			mz <- findMz(1)$mzCenter
    			msms_atrazine_all <- findMsMsHR.mass(msRaw, mz, 1, ppm(msRaw, 10, p=TRUE))
    			msms_atrazine <- msms_atrazine_all[[1]]

    ## End(Not run)

[Package RMassBank version 2.14.1 Index]