Uses a MS library loaded by loadMSLibrary for compound annotation.

generateCompoundsLibrary(fGroups, ...)

# S4 method for class 'featureGroups'
generateCompoundsLibrary(
  fGroups,
  MSPeakLists,
  MSLibrary,
  minSim = 0.75,
  minAnnSim = minSim,
  absMzDev = 0.002,
  adduct = NULL,
  checkIons = "adduct",
  spectrumType = "MS2",
  specSimParams = getDefSpecSimParams(),
  specSimParamsLib = getDefSpecSimParams()
)

# S4 method for class 'featureGroupsSet'
generateCompoundsLibrary(
  fGroups,
  MSPeakLists,
  MSLibrary,
  minSim = 0.75,
  minAnnSim = minSim,
  absMzDev = 0.002,
  adduct = NULL,
  ...,
  setThreshold = 0,
  setThresholdAnn = 0,
  setAvgSpecificScores = FALSE
)

Arguments

fGroups

featureGroups object which should be annotated. This should be the same or a subset of the object that was used to create the specified MSPeakLists. In the case of a subset only the remaining feature groups in the subset are considered.

...

Further arguments passed to the non-sets workflow method.

MSPeakLists

A MSPeakLists object that was generated for the supplied fGroups.

MSLibrary

The MSLibrary object that should be used to find candidates.

minSim

The minimum spectral similarity for candidate records.

minAnnSim

The minimum spectral similarity of a record for it to be used to find annotations (see the Details section).

absMzDev

The maximum absolute m/z deviation between the feature group and library record m/z values for candidate selection.

adduct

An adduct object (or something that can be converted to it with as.adduct). Examples: "[M-H]-", "[M+Na]+". If the featureGroups object has adduct annotations then these are used if adducts=NULL.

The adduct argument is not supported for sets workflows, since the adduct annotations will then always be used.

checkIons

A character that excludes library records with different adduct (checkIons="adduct") or MS ionization polarity (checkIons="polarity"). If checkIons="none" then these filters are not applied.

spectrumType

A character vector which limits library records to the given spectrum types (Spectrum_type field, e.g. "MS2"). Set to NULL to allow all spectrum types.

specSimParams

A named list with parameters that influence the calculation of MS spectra similarities. See the spectral similarity parameters documentation for more details.

specSimParamsLib

Like specSimParams, but these parameters only influence pre-treatment of library spectra (only the removePrecursor, relMinIntensity and minPeaks parameters are used).

setThreshold

Minimum abundance for a candidate among all sets (0-1). For instance, a value of 1 means that the candidate needs to be present in all the set data.

setThresholdAnn

As setThreshold, but only taking into account the set data that contain annotations for the feature group of the candidate.

setAvgSpecificScores

If TRUE then set specific scorings (e.g. MS/MS match) are also averaged.

Details

This function uses MS library spectra to generate compound candidates. This function is called when calling generateCompounds with algorithm="library".

This method matches measured MS/MS data (peak lists) with those from an MS library to find candidate structures. Hence, only feature groups with MS/MS peak list data are annotated.

The library is searched for candidates with the following criteria:

  1. Only records with ion m/z (PrecursorMZ), SMILES, InChI, InChIKey and formula data are considered.

  2. Depending on the value of the checkIons argument, records with different adduct (Precursor_type) or polarity (Ion_mode) may be ignored.

  3. The m/z values of the candidate and feature group should match (tolerance set by absMzDev argument).

  4. The spectral similarity should not be lower than the value defined for the minSim argument.

  5. If multiple candidates with the same first-block InChIKey are found then only the candidate with the best spectral match is kept.

If the library contains annotations these will be added to the matched MS/MS peaks. However, since the candidate selected from criterion #5 above may not contain all the annotation data available from the MS library, annotations from other records are also considered (controlled by the minAnnSim argument). If this leads to different annotations for the same mass peak then only the most abundant annotation is kept.

See also

generateCompounds for more details and other algorithms.

loadMSLibrary to obtain MS library data and the methods for MSLibrary to treat the data before using it for annotation.