OpenMS  2.7.0
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CalibrationData Class Reference

A helper class, holding all calibration points. More...

#include <OpenMS/DATASTRUCTURES/CalibrationData.h>

Collaboration diagram for CalibrationData:
[legend]

Public Types

typedef RichPeak2D CalDataType
 
typedef std::vector< CalDataType >::const_iterator const_iterator
 
typedef std::vector< CalDataType >::value_type value_type
 

Public Member Functions

 CalibrationData ()
 Default constructor. More...
 
CalDataType::CoordinateType getMZ (Size i) const
 Retrieve the observed m/z of the i'th calibration point. More...
 
CalDataType::CoordinateType getRT (Size i) const
 Retrieve the observed RT of the i'th calibration point. More...
 
CalDataType::CoordinateType getIntensity (Size i) const
 Retrieve the intensity of the i'th calibration point. More...
 
const_iterator begin () const
 Begin iterator for calibration points. More...
 
const_iterator end () const
 Past-the-end iterator for calibration points. More...
 
Size size () const
 Number of calibration points. More...
 
bool empty () const
 Do we have any calibration points. More...
 
void clear ()
 Remove all calibration points. More...
 
void setUsePPM (bool usePPM)
 When calling getError(), should ppm error or m/z error be returned? More...
 
bool usePPM () const
 Current error unit (ppm or Th) More...
 
void insertCalibrationPoint (CalDataType::CoordinateType rt, CalDataType::CoordinateType mz_obs, CalDataType::IntensityType intensity, CalDataType::CoordinateType mz_ref, double weight, int group=-1)
 Add a new calibration point. More...
 
Size getNrOfGroups () const
 Number of peak groups (can be 0). More...
 
CalDataType::CoordinateType getError (Size i) const
 Retrieve the error for i'th calibrant in either ppm or Th (depending on usePPM()) More...
 
CalDataType::CoordinateType getRefMZ (Size i) const
 Retrieve the theoretical m/z of the i'th calibration point. More...
 
CalDataType::CoordinateType getWeight (Size i) const
 Retrieve the weight of the i'th calibration point. More...
 
int getGroup (Size i) const
 Retrieve the group of the i'th calibration point. More...
 
CalibrationData median (double rt_left, double rt_right) const
 Compute the median in the given RT range for every peak group. More...
 
void sortByRT ()
 Sort calibration points by RT, to allow for valid RT chunking. More...
 

Static Public Member Functions

static StringList getMetaValues ()
 List of meta-values which are used internally (for conversion to PeakMap). More...
 

Private Attributes

std::vector< RichPeak2Ddata_
 calibration points More...
 
bool use_ppm_
 return ppm values as y-values for the model instead of absolute delta in [Th] More...
 
std::set< int > groups_
 peak groups present in this data More...
 

Detailed Description

A helper class, holding all calibration points.

Calibration points can be filled from Peptide IDs (using FeatureMaps or vector<PeptideIds>) or from lock masses in Raw data (MSExperiment).

The m/z error can be queried using getError(). The unit of error is either ppm or Th, depending on usePPM().

Each calibration point can be assigned to a peak group. This should be done for calibration points derived from lock masses, to enable querying for a medianized representation of a lock mass trace in a certain RT range (see median()). For calibration points derived from peptide IDs, this does not make sense.

From this data, a calibration function can be computed (see MZTrafoModel class).

Member Typedef Documentation

◆ CalDataType

◆ const_iterator

typedef std::vector<CalDataType>::const_iterator const_iterator

◆ value_type

typedef std::vector<CalDataType>::value_type value_type

Constructor & Destructor Documentation

◆ CalibrationData()

Default constructor.

Member Function Documentation

◆ begin()

const_iterator begin ( ) const

Begin iterator for calibration points.

◆ clear()

void clear ( )

Remove all calibration points.

◆ empty()

bool empty ( ) const

Do we have any calibration points.

◆ end()

const_iterator end ( ) const

Past-the-end iterator for calibration points.

◆ getError()

CalDataType::CoordinateType getError ( Size  i) const

Retrieve the error for i'th calibrant in either ppm or Th (depending on usePPM())

◆ getGroup()

int getGroup ( Size  i) const

Retrieve the group of the i'th calibration point.

Parameters
iIndex
Returns
Group; returns -1 if peak has no group.

◆ getIntensity()

CalDataType::CoordinateType getIntensity ( Size  i) const

Retrieve the intensity of the i'th calibration point.

◆ getMetaValues()

static StringList getMetaValues ( )
static

List of meta-values which are used internally (for conversion to PeakMap).

◆ getMZ()

CalDataType::CoordinateType getMZ ( Size  i) const

Retrieve the observed m/z of the i'th calibration point.

◆ getNrOfGroups()

Size getNrOfGroups ( ) const

Number of peak groups (can be 0).

◆ getRefMZ()

CalDataType::CoordinateType getRefMZ ( Size  i) const

Retrieve the theoretical m/z of the i'th calibration point.

◆ getRT()

CalDataType::CoordinateType getRT ( Size  i) const

Retrieve the observed RT of the i'th calibration point.

◆ getWeight()

CalDataType::CoordinateType getWeight ( Size  i) const

Retrieve the weight of the i'th calibration point.

◆ insertCalibrationPoint()

void insertCalibrationPoint ( CalDataType::CoordinateType  rt,
CalDataType::CoordinateType  mz_obs,
CalDataType::IntensityType  intensity,
CalDataType::CoordinateType  mz_ref,
double  weight,
int  group = -1 
)

Add a new calibration point.

Parameters
rtRetention time
mz_obsObserved m/z
intensityIntensity (useful for weighted model fitting)
mz_refTheoretical m/z
weightWeight of calibration point (useful for weighted model fitting)
groupPeak group of this calibration point. Using -1 will not assign any peak group. See also: median()

◆ median()

CalibrationData median ( double  rt_left,
double  rt_right 
) const

Compute the median in the given RT range for every peak group.

This is usually applied on calibration data obtained from lock masses, where each lock mass has its own peak group. Median() then computes an 'medianized' observed(!) lock mass within a certain RT range and returns calibration data with one calibration point per group. Also intensity is 'medianized'. The theoretical m/z is expected to be identical for all calibration points in a peak group.

Groups must be specified during insertCalibrationPoint(). If no groups are present, the result is empty.

The container must be sorted by RT (see sortByRT())!

Parameters
rt_leftLeft border of RT range to medianize
rt_rightRight border of RT range to medianize
Returns
New container, containing median representation for each peak group

◆ setUsePPM()

void setUsePPM ( bool  usePPM)

When calling getError(), should ppm error or m/z error be returned?

◆ size()

Size size ( ) const

Number of calibration points.

◆ sortByRT()

void sortByRT ( )

Sort calibration points by RT, to allow for valid RT chunking.

◆ usePPM()

bool usePPM ( ) const

Current error unit (ppm or Th)

Member Data Documentation

◆ data_

std::vector<RichPeak2D> data_
private

calibration points

◆ groups_

std::set<int> groups_
private

peak groups present in this data

◆ use_ppm_

bool use_ppm_
private

return ppm values as y-values for the model instead of absolute delta in [Th]