OpenMS
SplineInterpolatedPeaks Class Reference

Data structure for spline interpolation of MS1 spectra and chromatograms. More...

#include <OpenMS/PROCESSING/MISC/SplineInterpolatedPeaks.h>

Collaboration diagram for SplineInterpolatedPeaks:
[legend]

Classes

class  Navigator
 iterator class for access of spline packages More...
 

Public Member Functions

 SplineInterpolatedPeaks (const std::vector< double > &pos, const std::vector< double > &intensity)
 constructor taking two vectors (and an optional scaling factor for the m/z (or RT) step width) More...
 
 SplineInterpolatedPeaks (const MSSpectrum &raw_spectrum)
 constructor taking an MSSpectrum (and an optional scaling factor for the m/z step width) More...
 
 SplineInterpolatedPeaks (const MSChromatogram &raw_chromatogram)
 constructor taking an MSChromatogram (and an optional scaling factor for the RT step width) More...
 
 ~SplineInterpolatedPeaks ()
 destructor More...
 
double getPosMin () const
 returns the minimum m/z (or RT) of the spectrum More...
 
double getPosMax () const
 returns the maximum m/z (or RT) of the spectrum More...
 
size_t size () const
 Get number of spline packages found during initialization. More...
 
SplineInterpolatedPeaks::Navigator getNavigator (double scaling=0.7)
 returns an iterator for access of spline packages More...
 

Private Member Functions

 SplineInterpolatedPeaks ()
 hide default C'tor More...
 
void init_ (const std::vector< double > &pos, const std::vector< double > &intensity)
 section common for all constructors More...
 

Private Attributes

double pos_min_
 m/z (or RT) limits of the spectrum More...
 
double pos_max_
 
std::vector< SplinePackagepackages_
 set of spline packages each interpolating in a certain m/z (or RT) range More...
 

Detailed Description

Data structure for spline interpolation of MS1 spectra and chromatograms.

The data structure consists of a set of splines, each interpolating the MS1 spectrum (or chromatogram) in a certain m/z (or RT) range. Between these splines no raw data points exist and the intensity is identical to zero.

A spline on non-equi-distant input data is not well supported in regions without data points. Hence, a spline tends to swing wildly in these regions and cannot be used for reliable interpolation. We assume that in m/z (or RT) regions without data points, the spectrum (or chromatogram) is identical to zero.

See also
SplinePackage
MSSpectrum
MSChromatogram

Constructor & Destructor Documentation

◆ SplineInterpolatedPeaks() [1/4]

SplineInterpolatedPeaks ( const std::vector< double > &  pos,
const std::vector< double > &  intensity 
)

constructor taking two vectors (and an optional scaling factor for the m/z (or RT) step width)

Note
Vectors are assumed to be sorted by m/z (or RT)!

◆ SplineInterpolatedPeaks() [2/4]

SplineInterpolatedPeaks ( const MSSpectrum raw_spectrum)

constructor taking an MSSpectrum (and an optional scaling factor for the m/z step width)

◆ SplineInterpolatedPeaks() [3/4]

SplineInterpolatedPeaks ( const MSChromatogram raw_chromatogram)

constructor taking an MSChromatogram (and an optional scaling factor for the RT step width)

◆ ~SplineInterpolatedPeaks()

destructor

◆ SplineInterpolatedPeaks() [4/4]

hide default C'tor

Member Function Documentation

◆ getNavigator()

SplineInterpolatedPeaks::Navigator getNavigator ( double  scaling = 0.7)

returns an iterator for access of spline packages

Will throw an exception if no packages were found during construction. Check using getSplineCount().

Make sure that the underlying SplineInterpolatedPeaks does not run out-of-scope since the Navigator relies on its data.

Parameters
scalingstep width scaling parameter
Exceptions
Exception::InvalidSizeif packages is empty

Referenced by SpectraMerger::averageProfileSpectra_().

◆ getPosMax()

double getPosMax ( ) const

returns the maximum m/z (or RT) of the spectrum

Referenced by SpectraMerger::averageProfileSpectra_().

◆ getPosMin()

double getPosMin ( ) const

returns the minimum m/z (or RT) of the spectrum

Referenced by SpectraMerger::averageProfileSpectra_().

◆ init_()

void init_ ( const std::vector< double > &  pos,
const std::vector< double > &  intensity 
)
private

section common for all constructors

◆ size()

size_t size ( ) const

Get number of spline packages found during initialization.

Note that this function should be called right after the C'tor to ensure the spectrum has some usable data to work on. In case there are no packages, a subsequent call to getNavigator() will throw an exception.

Member Data Documentation

◆ packages_

std::vector<SplinePackage> packages_
private

set of spline packages each interpolating in a certain m/z (or RT) range

◆ pos_max_

double pos_max_
private

◆ pos_min_

double pos_min_
private

m/z (or RT) limits of the spectrum