Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Types | Protected Member Functions | Static Protected Member Functions | List of all members
SpectraMerger Class Reference

Merges blocks of MS or MS2 spectra. More...

#include <OpenMS/FILTERING/TRANSFORMERS/SpectraMerger.h>

Inheritance diagram for SpectraMerger:
DefaultParamHandler ProgressLogger

Classes

class  SpectraDistance_
 

Public Types

typedef Map< Size, std::vector< Size > > MergeBlocks
 blocks of spectra (master-spectrum index to sacrifice-spectra(the ones being merged into the master-spectrum)) More...
 
typedef Map< Size, std::vector< std::pair< Size, double > > > AverageBlocks
 blocks of spectra (master-spectrum index to update to spectra to average over) More...
 
- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 

Public Member Functions

 SpectraMerger ()
 default constructor More...
 
 SpectraMerger (const SpectraMerger &source)
 copy constructor More...
 
virtual ~SpectraMerger ()
 destructor More...
 
SpectraMergeroperator= (const SpectraMerger &source)
 assignment operator More...
 
template<typename MapType >
void mergeSpectraBlockWise (MapType &exp)
 
template<typename MapType >
void mergeSpectraPrecursors (MapType &exp)
 merges spectra with similar precursors (must have MS2 level) More...
 
template<typename MapType >
void average (MapType &exp, String average_type)
 average over neighbouring spectra More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
virtual DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
 ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 

Protected Member Functions

template<typename MapType >
void mergeSpectra_ (MapType &exp, const MergeBlocks &spectra_to_merge, const UInt ms_level)
 merges blocks of spectra of a certain level More...
 
template<typename MapType >
void averageProfileSpectra_ (MapType &exp, const AverageBlocks &spectra_to_average_over, const UInt ms_level)
 average spectra (profile mode) More...
 
template<typename MapType >
void averageCentroidSpectra_ (MapType &exp, const AverageBlocks &spectra_to_average_over, const UInt ms_level)
 average spectra (centroid mode) More...
 
- Protected Member Functions inherited from DefaultParamHandler
virtual void updateMembers_ ()
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Static Protected Member Functions

static bool compareByFirst (std::pair< double, double > i, std::pair< double, double > j)
 comparator for sorting peaks (m/z, intensity) More...
 
- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 

Additional Inherited Members

- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Merges blocks of MS or MS2 spectra.

Parameter's are accessible via the DefaultParamHandler.

Member Typedef Documentation

typedef Map<Size, std::vector<std::pair<Size, double> > > AverageBlocks

blocks of spectra (master-spectrum index to update to spectra to average over)

typedef Map<Size, std::vector<Size> > MergeBlocks

blocks of spectra (master-spectrum index to sacrifice-spectra(the ones being merged into the master-spectrum))

Constructor & Destructor Documentation

default constructor

SpectraMerger ( const SpectraMerger source)

copy constructor

virtual ~SpectraMerger ( )
virtual

destructor

Member Function Documentation

void average ( MapType exp,
String  average_type 
)
inline
void averageCentroidSpectra_ ( MapType exp,
const AverageBlocks spectra_to_average_over,
const UInt  ms_level 
)
inlineprotected

average spectra (centroid mode)

Averages spectra in centroid mode of one MS level in an experiment. The blocks of spectra to be combined and their relative weights have previously determined. The averaged spectra are generated in two steps: (1) The m/z of all spectra in a block are collected and sorted. Their corresponing intensities are weighted. (2) m/z positions closer than mz_binning_width are combined to a single peak. The m/z are averaged and the corresponing intensities summed.

Parameters
expexperimental data to be averaged
spectra_to_average_overmapping of spectral index to set of spectra to average over with corresponding weights
ms_levelMS level of spectra to be averaged

References MSExperiment< PeakT, ChromatogramPeakT >::addSpectrum(), MSExperiment< PeakT, ChromatogramPeakT >::begin(), MSSpectrum< PeakT >::clear(), SpectraMerger::compareByFirst(), MSExperiment< PeakT, ChromatogramPeakT >::end(), ProgressLogger::endProgress(), Peak1D::setIntensity(), Peak1D::setMZ(), ProgressLogger::setProgress(), and ProgressLogger::startProgress().

void averageProfileSpectra_ ( MapType exp,
const AverageBlocks spectra_to_average_over,
const UInt  ms_level 
)
inlineprotected

average spectra (profile mode)

Averages spectra in profile mode of one MS level in an experiment. The blocks of spectra to be combined and their relative weights have previously been determined. The averaged spectra are generated in two steps: (1) The m/z of all spectra in a block are collected and sorted. m/z positions closer than mz_binning_width are removed. (2) At these positions the weighted sum of all spline interpolations is calculated. The first step ensures roughly the same sampling rate as the one of the original spectra. The exact m/z position is not crucial, since not the original intensities but the spline-interpolated intensities are used.

Parameters
expexperimental data to be averaged
spectra_to_average_overmapping of spectral index to set of spectra to average over with corresponding weights
ms_levelMS level of spectra to be averaged

References MSExperiment< PeakT, ChromatogramPeakT >::addSpectrum(), MSExperiment< PeakT, ChromatogramPeakT >::begin(), MSSpectrum< PeakT >::clear(), MSExperiment< PeakT, ChromatogramPeakT >::end(), SplineSpectrum::Navigator::eval(), SplineSpectrum::getMzMax(), SplineSpectrum::getMzMin(), SplineSpectrum::getNavigator(), Peak1D::setIntensity(), and Peak1D::setMZ().

static bool compareByFirst ( std::pair< double, double i,
std::pair< double, double j 
)
inlinestaticprotected

comparator for sorting peaks (m/z, intensity)

Referenced by SpectraMerger::averageCentroidSpectra_().

void mergeSpectra_ ( MapType exp,
const MergeBlocks spectra_to_merge,
const UInt  ms_level 
)
inlineprotected
void mergeSpectraBlockWise ( MapType exp)
inline
void mergeSpectraPrecursors ( MapType exp)
inline
SpectraMerger& operator= ( const SpectraMerger source)

assignment operator


OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 12:49:30 using doxygen 1.8.11