OpenMS
Loading...
Searching...
No Matches
ProSEAlgorithm::MzRecalibration_ Struct Reference

An m/z error model of a run (calibration:recalibrate), fitted to the calibration PSMs and subtracted from the spectra before the main search. More...

#include <OpenMS/ANALYSIS/ID/PROSE/ProSEAlgorithm.h>

Classes

struct  AtRT
 
struct  Chunk
 

Public Member Functions

bool active () const
 
double error (double mz, double rt) const
 the modelled error at (mz, rt)
 
double correct (double mz, double rt) const
 mz without the modelled error
 
double uncorrect (double corrected, double rt) const
 the inverse of correct(): the m/z it maps to corrected
 
AtRT at (double rt) const
 
std::string toString () const
 

Static Public Member Functions

static MzRecalibration_ fit (const std::vector< double > &errors, const std::vector< double > &mzs, const std::vector< double > &rts, Size n_chunks, Size min_points, bool linear, bool ppm, const std::vector< char > *decoys=nullptr)
 

Public Attributes

std::vector< Chunk > chunks
 in RT order; empty: no correction
 
bool ppm {true}
 the error unit: ppm (correction mz - e * mz * 1e-6) or Da (mz - e)
 

Detailed Description

An m/z error model of a run (calibration:recalibrate), fitted to the calibration PSMs and subtracted from the spectra before the main search.

Per retention-time chunk a linear function of m/z of the signed error (observed minus theoretical; the median alone, slope 0, with mode 'offset'), linearly interpolated between the chunks' centres and constant beyond them. The errors are in ppm or in the unit of the tolerance (Da); correct() removes the modelled error from an m/z.


Class Documentation

◆ OpenMS::ProSEAlgorithm::MzRecalibration_::Chunk

struct OpenMS::ProSEAlgorithm::MzRecalibration_::Chunk

one RT chunk: its centre (the median RT of its points), the model and the number of points it was fitted to; decoys: the decoys among its points (fit() with decoys); from_neighbours: its points are mostly false matches and its model is that of its neighbours (the median of all points when every chunk is such a chunk)

Class Members
Size decoys {0}
bool from_neighbours {false}
double intercept
Size points
double rt
double slope

Member Function Documentation

◆ active()

◆ at()

AtRT at ( double  rt) const

the model at rt (the chunks must not change while the result is used)

◆ correct()

double correct ( double  mz,
double  rt 
) const

mz without the modelled error

◆ error()

double error ( double  mz,
double  rt 
) const

the modelled error at (mz, rt)

◆ fit()

static MzRecalibration_ fit ( const std::vector< double > &  errors,
const std::vector< double > &  mzs,
const std::vector< double > &  rts,
Size  n_chunks,
Size  min_points,
bool  linear,
bool  ppm,
const std::vector< char > *  decoys = nullptr 
)
static

Fit the model: the points (error, m/z, RT) are split in RT order into n_chunks groups of equal size (fewer when a group would hold less than min_points points), each fitted to its points within three robust standard deviations of its median: the median (linear false) or the least-squares line in m/z (linear; the median when the line cannot be fitted). Deterministic (no RANSAC).

With decoys (one flag per point: the PSM is a decoy hit) a chunk where more than half of the points are estimated to be false matches (twice its decoys, as many false targets as decoys) is not fitted to its own points, whose median would be that of the false matches (OpenMS/OpenMS#10885): it takes the model of its neighbours (interpolated between the nearest such chunks before and after it at its RT, that of the nearest at the ends; the median of all points, no slope, when every chunk is such a chunk) and is marked from_neighbours.

◆ toString()

std::string toString ( ) const

"ppm; rt <s>: <intercept> + <slope> mz (<points>); ..." (empty: inactive); a chunk whose model is that of its neighbours: "(<points>, <decoys> decoys: mostly false matches)"

◆ uncorrect()

double uncorrect ( double  corrected,
double  rt 
) const

the inverse of correct(): the m/z it maps to corrected

Member Data Documentation

◆ chunks

std::vector<Chunk> chunks

in RT order; empty: no correction

◆ ppm

bool ppm {true}

the error unit: ppm (correction mz - e * mz * 1e-6) or Da (mz - e)