| OpenMS 2.5.0

Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | List of all members
PrecursorCorrection Class Reference

This class provides methods for precursor correction. More...

`#include <OpenMS/FILTERING/CALIBRATION/PrecursorCorrection.h>`

## Static Public Member Functions

static void | getPrecursors (const MSExperiment &exp, std::vector< Precursor > &precursors, std::vector< double > &precursors_rt, std::vector< Size > &precursor_scan_index)
| Extract precursors and associated information (precursor retention time and precursor scan index). More...
static void | writeHist (const String &out_csv, const std::vector< double > &delta_mzs, const std::vector< double > &mzs, const std::vector< double > &rts)
| Writer can be used in association with correctToNearestMS1Peak or correctToHighestIntensityMS1Peak. More...
static std::set< Size > | correctToNearestMS1Peak (MSExperiment &exp, double mz_tolerance, bool ppm, std::vector< double > &delta_mzs, std::vector< double > &mzs, std::vector< double > &rts)
| Selection of the peak in closest proximity as corrected precursor mass in a given mass range (e.g. precursor mass +/- 0.2 Da). More...
static std::set< Size > | correctToHighestIntensityMS1Peak (MSExperiment &exp, double mz_tolerance, bool ppm, std::vector< double > &delta_mzs, std::vector< double > &mzs, std::vector< double > &rts)
| Selection of the peak with the highest intensity as corrected precursor mass in a given mass range (e.g. precursor mass +/- 0.2 Da) More...
static std::set< Size > | correctToNearestFeature (const FeatureMap &features, MSExperiment &exp, double rt_tolerance_s=0.0, double mz_tolerance=0.0, bool ppm=true, bool believe_charge=false, bool keep_original=false, bool all_matching_features=false, int max_trace=2, int debug_level=0)
| Reassigns a precursor to the nearest feature in a given rt and mass range. Wrong assignment of the mono-isotopic mass for precursors are assumed: More...

## Static Public Attributes

static const std::string | csv_header

## Static Protected Member Functions

static bool | overlaps_ (const Feature &feature, const double rt, const double pc_mz, const double rt_tolerance)
| Check if precursor is located in the bounding box of a features convex hull. Here the bounding box of the feature is extended by the retention time tolerance and afterwards the precursor location is validated. More...
static bool | compatible_ (const Feature &feature, double pc_mz, double mz_tolerance, Size max_trace_number=2, int debug_level=0)
| Check precursor and feature compatibility If the precursor mz is in one of the masstraces the feature is compatible. Dependent on 13C mass difference and charge. More...

## Detailed Description

This class provides methods for precursor correction.

Supported methods: getPrecursors: Extract precursors and associated information (mz, scan index). writeHist: Write output .csv for validation purposes (corrected, uncorrected). correctToNearestMS1Peak: Correct to the peak in closest proximity in a certain mass range. correctToHighestIntensityMS1Peak: Correct to the peak with the highest intensity in a certain mass range. correctToNearestFeature: Use feature information to re-annotate a precursor (e.g. falsely assigned to non mono-isotopic trace).

## Member Function Documentation

## ◆ compatible_()

static bool compatible_ | ( | const Feature & | feature,
|  | double | pc_mz,
|  | double | mz_tolerance,
|  | Size | max_trace_number = `2`,
|  | int | debug_level = `0`
| ) |  |

static protected

Check precursor and feature compatibility If the precursor mz is in one of the masstraces the feature is compatible. Dependent on 13C mass difference and charge.

Parameters

  feature | constant Feature.
  pc_mz | double precursor mass to charge.
  mz_tolerance | double mass to charge tolerance.
  max_trace_number | Size maximum number of mass traces.
  debug_level | integer debug level.

Returns
  static boolean if the precursor mass to charge is in one of the features masstraces.

## ◆ correctToHighestIntensityMS1Peak()

static std::set<Size> correctToHighestIntensityMS1Peak | ( | MSExperiment & | exp,
|  | double | mz_tolerance,
|  | bool | ppm,
|  | std::vector< double > & | delta_mzs,
|  | std::vector< double > & | mzs,
|  | std::vector< double > & | rts
| ) |  |

static

Selection of the peak with the highest intensity as corrected precursor mass in a given mass range (e.g. precursor mass +/- 0.2 Da)

For each MS2 spectrum the corresponding MS1 spectrum is determined by using the rt information of the precursor. In the MS1, the peak with the highest intensity in a given mass range to the uncorrected precursor m/z is selected and used as corrected precursor m/z.

Parameters

  exp | MSExperiment.
  mz_tolerance | double tolerance used for precursor correction in mass range.
  ppm | bool enables usage of ppm.
  delta_mzs | vector double delta mass to charge.
  mzs | vector double mass to charge.
  rts | vector double retention time.

Returns
  set of Size with corrected precursor information.

Referenced by UTILProteomicsLFQ::centroidAndCorrectPrecursors_().

## ◆ correctToNearestFeature()

static std::set<Size> correctToNearestFeature | ( | const FeatureMap & | features,
|  | MSExperiment & | exp,
|  | double | rt_tolerance_s = `0.0`,
|  | double | mz_tolerance = `0.0`,
|  | bool | ppm = `true`,
|  | bool | believe_charge = `false`,
|  | bool | keep_original = `false`,
|  | bool | all_matching_features = `false`,
|  | int | max_trace = `2`,
|  | int | debug_level = `0`
| ) |  |

static

Reassigns a precursor to the nearest feature in a given rt and mass range. Wrong assignment of the mono-isotopic mass for precursors are assumed:

- if precursor_mz matches the mz of a non-monoisotopic feature mass trace
- and in the case that believe_charge is true: if feature_charge matches the precursor_charge In the case of wrong mono-isotopic assignment several options for correction are available: keep_original will create a copy of the precursor and tandem spectrum for the new mono-isotopic mass trace and retain the original one. all_matching_features does this not for only the closest feature but all features in a question.

Parameters

  features | constant FeatureMap.
  exp | MSExperiment.
  rt_tolerance_s | double retention time tolerance in seconds.
  mz_tolerance | double tolerance used for precursor correction in mass range.
  ppm | bool enables usage of ppm.
  believe_charge | bool only add features that match the precursor charge.
  keep_original | bool this will create a copy of the precursor and tandem spectrum for the new mono-isotopic trace and retain the original one.
  all_matching_features | bool correction is performed for all features in question not only the closest one.
  max_trace | integer maximal number of traces used.
  debug_level | integer debug level.

Returns
  set of Size with corrected precursor information.

## ◆ correctToNearestMS1Peak()

static std::set<Size> correctToNearestMS1Peak | ( | MSExperiment & | exp,
|  | double | mz_tolerance,
|  | bool | ppm,
|  | std::vector< double > & | delta_mzs,
|  | std::vector< double > & | mzs,
|  | std::vector< double > & | rts
| ) |  |

static

Selection of the peak in closest proximity as corrected precursor mass in a given mass range (e.g. precursor mass +/- 0.2 Da).

For each MS2 spectrum the corresponding MS1 spectrum is determined by using the rt information of the precursor. In the MS1, the peak closest to the uncorrected precursor m/z is selected and used as corrected precursor m/z.

Parameters

  exp | MSExperiment.
  mz_tolerance | double tolerance used for precursor correction in mass range.
  ppm | bool enables usage of ppm.
  delta_mzs | vector double delta mass to charge.
  mzs | vector double mass to charge.
  rts | vector double retention time.

Returns
  set of Size with corrected precursor information.

## ◆ getPrecursors()

static void getPrecursors | ( | const MSExperiment & | exp,
|  | std::vector< Precursor > & | precursors,
|  | std::vector< double > & | precursors_rt,
|  | std::vector< Size > & | precursor_scan_index
| ) |  |

static

Extract precursors and associated information (precursor retention time and precursor scan index).

Parameters

  exp | constant MSExperiment.
  precursors | vector of Precursor.
  precursors_rt | vector double of precursors retention time.
  precursor_scan_index | vector size of precursor scan index.

Returns
  vectors of Precursor, precursor retention time and precursor scan index.

## ◆ overlaps_()

static bool overlaps_ | ( | const Feature & | feature,
|  | const double | rt,
|  | const double | pc_mz,
|  | const double | rt_tolerance
| ) |  |

static protected

Check if precursor is located in the bounding box of a features convex hull. Here the bounding box of the feature is extended by the retention time tolerance and afterwards the precursor location is validated.

Parameters

  feature | constant Feature.
  rt | constant double retention time.
  pc_mz | constant double precursor mass to charge.
  rt_tolerance | constant double retention time tolerance in seconds.

Returns
  static boolean to check if the precursor is located in the bounding box of a features convex hull.

## ◆ writeHist()

static void writeHist | ( | const String & | out_csv,
|  | const std::vector< double > & | delta_mzs,
|  | const std::vector< double > & | mzs,
|  | const std::vector< double > & | rts
| ) |  |

static

Writer can be used in association with correctToNearestMS1Peak or correctToHighestIntensityMS1Peak.

Parameters

  out_csv | constant String for csv output.
  delta_mzs | constant vector double delta mass to charge.
  mzs | constant vector double mass to charge.
  rts | constant vector double retention time.

Returns
  A csv file with additional information (RT, uncorrectedMZ, correctedMZ, deltaMZ).

Format: RT uncorrectedMZ correctedMZ deltaMZ 100.1 509.9999 510 0.0001 180.9 610.0001 610 -0.0001 183.92 611.0035 611.0033 -0.0002

## Member Data Documentation

## ◆ csv_header

const std::string csv_header

static