| OpenMS 2.5.0

Public Types | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
MassTrace Class Reference
Kernel

A container type that gathers peaks similar in m/z and moving along retention time. More...

`#include <OpenMS/KERNEL/MassTrace.h>`

## Public Types

enum | MT_QUANTMETHOD { MT_QUANT_AREA = 0, MT_QUANT_MEDIAN, MT_QUANT_HEIGHT, SIZE_OF_MT_QUANTMETHOD }

## Public Member Functions

Constructors and Destructor
| MassTrace ()
| Default constructor. More...
| MassTrace (const std::list< PeakType > &trace_peaks)
| MassTrace (const std::vector< PeakType > &trace_peaks)
| Detailed constructor for vector. More...
| ~MassTrace ()
| Destructor. More...
| MassTrace (const MassTrace &)
| Copy constructor. More...
MassTrace & | operator= (const MassTrace &)
| Assignment operator. More...
PeakType & | operator[] (const Size &mt_idx)
| Random access operator. More...
const PeakType & | operator[] (const Size &mt_idx) const
Accessor methods
Size | getSize () const
| Returns the number of peaks contained in the mass trace. More...
String | getLabel () const
| Gets label of mass trace. More...
void | setLabel (const String &label)
| Sets label of mass trace. More...
double | getCentroidMZ () const
| Returns the centroid m/z. More...
double | getCentroidRT () const
| Returns the centroid RT. More...
double | getCentroidSD () const
void | setCentroidSD (const double &tmp_sd)
double | getFWHM () const
double | getTraceLength () const
| Returns the length of the trace (as difference in RT) More...
std::pair< Size, Size > | getFWHMborders () const
const std::vector< double > & | getSmoothedIntensities () const
| Gets smoothed intensities (empty if no smoothing was explicitly done beforehand!). More...
void | setSmoothedIntensities (const std::vector< double > &db_vec)
| Set smoothed intensities (smoothing is done externally, e.g. by LowessSmoothing). More...
double | getAverageMS1CycleTime () const
| Get average scan time of mass trace. More...
Computational methods
double | computeSmoothedPeakArea () const
| Sum all non-negative (smoothed!) intensities in the mass trace. More...
double | computePeakArea () const
| Sum intensities of all peaks in the mass trace. More...
Size | findMaxByIntPeak (bool use_smoothed_ints=false) const
| Return the index of the mass trace's highest peak within the MassTrace container (based either on raw or smoothed intensities). More...
double | estimateFWHM (bool use_smoothed_ints=false)
void | setQuantMethod (MT_QUANTMETHOD method)
| determine if area or median is used for quantification More...
MT_QUANTMETHOD | getQuantMethod () const
| check if area or median is used for quantification More...
double | computeFwhmAreaSmooth () const
| Compute chromatographic peak area within the FWHM range. More...
double | computeFwhmArea () const
double | getIntensity (bool smoothed) const
double | getMaxIntensity (bool smoothed) const
ConvexHull2D | getConvexhull () const
| Return the mass trace's convex hull. More...
Update methods for centroid RT and m/z
void | updateSmoothedMaxRT ()
void | updateWeightedMeanRT ()
| Compute & update centroid RT as a intensity-weighted mean of RTs. More...
void | updateSmoothedWeightedMeanRT ()
void | updateMedianRT ()
| Compute & update centroid RT as median position of intensities. More...
void | updateMedianMZ ()
| Compute & update centroid m/z as median of m/z values. More...
void | updateMeanMZ ()
| Compute & update centroid m/z as mean of m/z values. More...
void | updateWeightedMeanMZ ()
| Compute & update centroid m/z as weighted mean of m/z values. More...
void | updateWeightedMZsd ()
| Compute & update m/z standard deviation of mass trace as weighted mean of m/z values. More...

## Static Public Member Functions

static MT_QUANTMETHOD | getQuantMethod (const String &val)
| converts a string to enum value; returns 'SIZE_OF_MT_QUANTMETHOD' upon error More...

## Public Attributes

double | fwhm_mz_avg
| Average FWHM of m/z peaks. More...

## Static Public Attributes

static const std::string | names_of_quantmethod [SIZE_OF_MT_QUANTMETHOD]

## Private Member Functions

double | computeMedianIntensity_ () const
| median of trace intensities More...
double | linearInterpolationAtY_ (double xA, double xB, double yA, double yB, double y_eval) const

## Private Attributes

std::vector< PeakType > | trace_peaks_
| Actual MassTrace container for doing centroid calculation, peak width estimation etc. More...
double | centroid_mz_
| Centroid m/z. More...
double | centroid_sd_
| intensity-weighted STD More...
double | centroid_rt_
| Centroid RT. More...
String | label_
| Trace label. More...
std::vector< double > | smoothed_intensities_
| Container for smoothed intensities. Smoothing must be done externally. More...
double | fwhm_
| FWHM of RT peak. More...
Size | fwhm_start_idx_
| index into 'trace_peaks_' vector (inclusive) More...
Size | fwhm_end_idx_
| index into 'trace_peaks_' vector (inclusive) More...
MT_QUANTMETHOD | quant_method_
| use area under mass trace or the median of intensities More...

## Iterators

Enables mutable/immutable access to the mass trace's peaks.
typedef std::vector< PeakType >::iterator | iterator
typedef std::vector< PeakType >::const_iterator | const_iterator
typedef std::vector< PeakType >::reverse_iterator | reverse_iterator
typedef std::vector< PeakType >::const_reverse_iterator | const_reverse_iterator
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
reverse_iterator | rbegin ()
reverse_iterator | rend ()
const_reverse_iterator | rbegin () const
const_reverse_iterator | rend () const

## Detailed Description

A container type that gathers peaks similar in m/z and moving along retention time.

Depending on the method of extraction a mass trace could virtually represent a complete extracted ion chromatogram (XIC) or merely a part of it (e.g., a chromatographic peak). The kernel class provides methods for computing mass trace characteristics such as its centroid m/z and retention time. Coeluting mass traces can be further assembled to complete isotope patterns of peptides/metabolites.

## Member Typedef Documentation

## ◆ const_iterator

typedef std::vector<PeakType>::const_iterator const_iterator

## ◆ const_reverse_iterator

typedef std::vector<PeakType>::const_reverse_iterator const_reverse_iterator

## ◆ iterator

typedef std::vector<PeakType>::iterator iterator

## ◆ reverse_iterator

typedef std::vector<PeakType>::reverse_iterator reverse_iterator

## Member Enumeration Documentation

## ◆ MT_QUANTMETHOD

enum MT_QUANTMETHOD

Enumerator
MT_QUANT_AREA | quantify by area
MT_QUANT_MEDIAN | quantify by median of intensities
MT_QUANT_HEIGHT | quantify by peak height
SIZE_OF_MT_QUANTMETHOD |

## Constructor & Destructor Documentation

## ◆ MassTrace() [1/4]

MassTrace | ( |  | ) |

Default constructor.

## ◆ MassTrace() [2/4]

MassTrace | ( | const std::list< PeakType > & | trace_peaks | ) |

Detailed constructor (useful, since Mass Traces are commonly assembled by prepending and appending – which is faster using lists)

## ◆ MassTrace() [3/4]

MassTrace | ( | const std::vector< PeakType > & | trace_peaks | ) |

Detailed constructor for vector.

## ◆ ~MassTrace()

~MassTrace | ( |  | ) |

Destructor.

## ◆ MassTrace() [4/4]

MassTrace | ( | const MassTrace & |  | ) |

Copy constructor.

## Member Function Documentation

## ◆ begin() [1/2]

iterator begin | ( |  | ) |

inline

## ◆ begin() [2/2]

const_iterator begin | ( |  | ) | const

inline

## ◆ computeFwhmArea()

double computeFwhmArea | ( |  | ) | const

## ◆ computeFwhmAreaSmooth()

double computeFwhmAreaSmooth | ( |  | ) | const

Compute chromatographic peak area within the FWHM range.

## ◆ computeMedianIntensity_()

double computeMedianIntensity_ | ( |  | ) | const

private

median of trace intensities

## ◆ computePeakArea()

double computePeakArea | ( |  | ) | const

Sum intensities of all peaks in the mass trace.

## ◆ computeSmoothedPeakArea()

double computeSmoothedPeakArea | ( |  | ) | const

Sum all non-negative (smoothed!) intensities in the mass trace.

## ◆ end() [1/2]

iterator end | ( |  | ) |

inline

## ◆ end() [2/2]

const_iterator end | ( |  | ) | const

inline

## ◆ estimateFWHM()

double estimateFWHM | ( | bool | use_smoothed_ints = `false` | ) |

Estimate FWHM of chromatographic peak in seconds (based on either raw or smoothed intensities). Uses linear interpolation of the two closest points to the half_max intensity in order to get the RT values at exactly the half_max stores result internally, use getFWHM().

## ◆ findMaxByIntPeak()

Size findMaxByIntPeak | ( | bool | use_smoothed_ints = `false` | ) | const

Return the index of the mass trace's highest peak within the MassTrace container (based either on raw or smoothed intensities).

## ◆ getAverageMS1CycleTime()

double getAverageMS1CycleTime | ( |  | ) | const

inline

Get average scan time of mass trace.

## ◆ getCentroidMZ()

double getCentroidMZ | ( |  | ) | const

inline

Returns the centroid m/z.

Referenced by CmpMassTraceByMZ::operator()().

## ◆ getCentroidRT()

double getCentroidRT | ( |  | ) | const

inline

Returns the centroid RT.

## ◆ getCentroidSD()

double getCentroidSD | ( |  | ) | const

inline

## ◆ getConvexhull()

ConvexHull2D getConvexhull | ( |  | ) | const

Return the mass trace's convex hull.

## ◆ getFWHM()

double getFWHM | ( |  | ) | const

inline

## ◆ getFWHMborders()

std::pair<Size, Size> getFWHMborders | ( |  | ) | const

inline

## ◆ getIntensity()

double getIntensity | ( | bool | smoothed | ) | const

## ◆ getLabel()

String getLabel | ( |  | ) | const

inline

Gets label of mass trace.

## ◆ getMaxIntensity()

double getMaxIntensity | ( | bool | smoothed | ) | const

## ◆ getQuantMethod() [1/2]

static MT_QUANTMETHOD getQuantMethod | ( | const String & | val | ) |

static

converts a string to enum value; returns 'SIZE_OF_MT_QUANTMETHOD' upon error

## ◆ getQuantMethod() [2/2]

MT_QUANTMETHOD getQuantMethod | ( |  | ) | const

check if area or median is used for quantification

## ◆ getSize()

Size getSize | ( |  | ) | const

inline

Returns the number of peaks contained in the mass trace.

## ◆ getSmoothedIntensities()

const std::vector<double>& getSmoothedIntensities | ( |  | ) | const

inline

Gets smoothed intensities (empty if no smoothing was explicitly done beforehand!).

## ◆ getTraceLength()

double getTraceLength | ( |  | ) | const

inline

Returns the length of the trace (as difference in RT)

## ◆ linearInterpolationAtY_()

double linearInterpolationAtY_ | ( | double | xA,
|  | double | xB,
|  | double | yA,
|  | double | yB,
|  | double | y_eval
| ) |  | const

private

calculate x coordinate of start/end indexes at half_max calculation is based on (yB - yA) / (xB - xA) = (y_eval - yA) / (xC - xA) solve for xC: xC = xA + ((y_eval - yA) * (xB - xA) / (yB - yA))

## ◆ operator=()

MassTrace& operator= | ( | const MassTrace & |  | ) |

Assignment operator.

## ◆ operator[]() [1/2]

PeakType& operator[] | ( | const Size & | mt_idx | ) |

Random access operator.

## ◆ operator[]() [2/2]

const PeakType& operator[] | ( | const Size & | mt_idx | ) | const

## ◆ rbegin() [1/2]

reverse_iterator rbegin | ( |  | ) |

inline

## ◆ rbegin() [2/2]

const_reverse_iterator rbegin | ( |  | ) | const

inline

## ◆ rend() [1/2]

reverse_iterator rend | ( |  | ) |

inline

## ◆ rend() [2/2]

const_reverse_iterator rend | ( |  | ) | const

inline

## ◆ setCentroidSD()

void setCentroidSD | ( | const double & | tmp_sd | ) |

inline

## ◆ setLabel()

void setLabel | ( | const String & | label | ) |

inline

Sets label of mass trace.

## ◆ setQuantMethod()

void setQuantMethod | ( | MT_QUANTMETHOD | method | ) |

determine if area or median is used for quantification

## ◆ setSmoothedIntensities()

void setSmoothedIntensities | ( | const std::vector< double > & | db_vec | ) |

inline

Set smoothed intensities (smoothing is done externally, e.g. by LowessSmoothing).

## ◆ updateMeanMZ()

void updateMeanMZ | ( |  | ) |

Compute & update centroid m/z as mean of m/z values.

## ◆ updateMedianMZ()

void updateMedianMZ | ( |  | ) |

Compute & update centroid m/z as median of m/z values.

## ◆ updateMedianRT()

void updateMedianRT | ( |  | ) |

Compute & update centroid RT as median position of intensities.

## ◆ updateSmoothedMaxRT()

void updateSmoothedMaxRT | ( |  | ) |

## ◆ updateSmoothedWeightedMeanRT()

void updateSmoothedWeightedMeanRT | ( |  | ) |

## ◆ updateWeightedMeanMZ()

void updateWeightedMeanMZ | ( |  | ) |

Compute & update centroid m/z as weighted mean of m/z values.

## ◆ updateWeightedMeanRT()

void updateWeightedMeanRT | ( |  | ) |

Compute & update centroid RT as a intensity-weighted mean of RTs.

## ◆ updateWeightedMZsd()

void updateWeightedMZsd | ( |  | ) |

Compute & update m/z standard deviation of mass trace as weighted mean of m/z values.

Make sure to call update(Weighted)(Mean|Median)MZ() first!
use getCentroidSD() to get result

## Member Data Documentation

## ◆ centroid_mz_

double centroid_mz_

private

Centroid m/z.

## ◆ centroid_rt_

double centroid_rt_

private

Centroid RT.

## ◆ centroid_sd_

double centroid_sd_

private

intensity-weighted STD

## ◆ fwhm_

double fwhm_

private

FWHM of RT peak.

## ◆ fwhm_end_idx_

Size fwhm_end_idx_

private

index into 'trace_peaks_' vector (inclusive)

## ◆ fwhm_mz_avg

double fwhm_mz_avg

Average FWHM of m/z peaks.

## ◆ fwhm_start_idx_

Size fwhm_start_idx_

private

index into 'trace_peaks_' vector (inclusive)

## ◆ label_

String label_

private

Trace label.

## ◆ names_of_quantmethod

const std::string names_of_quantmethod[SIZE_OF_MT_QUANTMETHOD]

static

## ◆ quant_method_

MT_QUANTMETHOD quant_method_

private

use area under mass trace or the median of intensities

## ◆ smoothed_intensities_

std::vector<double> smoothed_intensities_

private

Container for smoothed intensities. Smoothing must be done externally.

## ◆ trace_peaks_

std::vector<PeakType> trace_peaks_

private

Actual MassTrace container for doing centroid calculation, peak width estimation etc.