OpenMS  2.7.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>

Collaboration diagram for PrecursorCorrection:
[legend]

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< SizecorrectToNearestMS1Peak (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< SizecorrectToHighestIntensityMS1Peak (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< SizecorrectToNearestFeature (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 
)
staticprotected

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
featureconstant Feature.
pc_mzdouble precursor mass to charge.
mz_tolerancedouble mass to charge tolerance.
max_trace_numberSize maximum number of mass traces.
debug_levelinteger 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
expMSExperiment.
mz_tolerancedouble tolerance used for precursor correction in mass range.
ppmbool enables usage of ppm.
delta_mzsvector double delta mass to charge.
mzsvector double mass to charge.
rtsvector double retention time.
Returns
set of Size with corrected precursor information.

◆ 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
featuresconstant FeatureMap.
expMSExperiment.
rt_tolerance_sdouble retention time tolerance in seconds.
mz_tolerancedouble tolerance used for precursor correction in mass range.
ppmbool enables usage of ppm.
believe_chargebool only add features that match the precursor charge.
keep_originalbool this will create a copy of the precursor and tandem spectrum for the new mono-isotopic trace and retain the original one.
all_matching_featuresbool correction is performed for all features in question not only the closest one.
max_traceinteger maximal number of traces used.
debug_levelinteger 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
expMSExperiment.
mz_tolerancedouble tolerance used for precursor correction in mass range.
ppmbool enables usage of ppm.
delta_mzsvector double delta mass to charge.
mzsvector double mass to charge.
rtsvector 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
expconstant MSExperiment.
precursorsvector of Precursor.
precursors_rtvector double of precursors retention time.
precursor_scan_indexvector 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 
)
staticprotected

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
featureconstant Feature.
rtconstant double retention time.
pc_mzconstant double precursor mass to charge.
rt_toleranceconstant 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_csvconstant String for csv output.
delta_mzsconstant vector double delta mass to charge.
mzsconstant vector double mass to charge.
rtsconstant 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