OpenMS
SignalToNoiseEstimatorMedian< Container > Class Template Reference

Estimates the signal/noise (S/N) ratio of each data point in a scan by using the median (histogram based) More...

#include <OpenMS/FILTERING/NOISEESTIMATION/SignalToNoiseEstimatorMedian.h>

Inheritance diagram for SignalToNoiseEstimatorMedian< Container >:
[legend]
Collaboration diagram for SignalToNoiseEstimatorMedian< Container >:
[legend]

Public Types

enum  IntensityThresholdCalculation { MANUAL = -1 , AUTOMAXBYSTDEV = 0 , AUTOMAXBYPERCENT = 1 }
 method to use for estimating the maximal intensity that is used for histogram calculation More...
 
typedef SignalToNoiseEstimator< Container >::PeakIterator PeakIterator
 
typedef SignalToNoiseEstimator< Container >::PeakType PeakType
 
typedef SignalToNoiseEstimator< Container >::GaussianEstimate GaussianEstimate
 
- Public Types inherited from SignalToNoiseEstimator< MSSpectrum >
typedef Container::const_iterator PeakIterator
 
typedef PeakIterator::value_type PeakType
 
- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 

Public Member Functions

 SignalToNoiseEstimatorMedian ()
 default constructor More...
 
 SignalToNoiseEstimatorMedian (const SignalToNoiseEstimatorMedian &source)
 Copy Constructor. More...
 
- Public Member Functions inherited from SignalToNoiseEstimator< MSSpectrum >
 SignalToNoiseEstimator ()
 Constructor. More...
 
 SignalToNoiseEstimator (const SignalToNoiseEstimator &source)
 Copy constructor. More...
 
SignalToNoiseEstimatoroperator= (const SignalToNoiseEstimator &source)
 Assignment operator. More...
 
 ~SignalToNoiseEstimator () override
 Destructor. More...
 
virtual void init (const MSSpectrum &c)
 Set the start and endpoint of the raw data interval, for which signal to noise ratios will be estimated immediately. More...
 
virtual double getSignalToNoise (const Size index) const
 
- 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...
 
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...
 
virtual ~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...
 
void nextProgress () const
 increment progress by 1 (according to range begin-end) More...
 

Assignment

double max_intensity_
 maximal intensity considered during binning (values above get discarded) More...
 
double auto_max_stdev_Factor_
 parameter for initial automatic estimation of "max_intensity_": a stdev multiplier More...
 
double auto_max_percentile_
 parameter for initial automatic estimation of "max_intensity_" percentile or a stdev More...
 
int auto_mode_
 determines which method shall be used for estimating "max_intensity_". valid are MANUAL=-1, AUTOMAXBYSTDEV=0 or AUTOMAXBYPERCENT=1 More...
 
double win_len_
 range of data points which belong to a window in Thomson More...
 
int bin_count_
 number of bins in the histogram More...
 
int min_required_elements_
 minimal number of elements a window needs to cover to be used More...
 
double noise_for_empty_window_
 
bool write_log_messages_
 
double sparse_window_percent_
 
double histogram_oob_percent_
 
SignalToNoiseEstimatorMedianoperator= (const SignalToNoiseEstimatorMedian &source)
 
 ~SignalToNoiseEstimatorMedian () override
 Destructor. More...
 
double getSparseWindowPercent () const
 Returns how many percent of the windows were sparse. More...
 
double getHistogramRightmostPercent () const
 Returns the percentage where the median was found in the rightmost bin. More...
 
void computeSTN_ (const Container &c) override
 
void updateMembers_ () override
 overridden function from DefaultParamHandler to keep members up to date, when a parameter is changed More...
 

Additional Inherited Members

- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &key_prefix="")
 Writes all parameters to meta values. More...
 
- Protected Member Functions inherited from SignalToNoiseEstimator< MSSpectrum >
virtual void computeSTN_ (const MSSpectrum &c)=0
 computes the S/N values when init() is called More...
 
GaussianEstimate estimate_ (const PeakIterator &scan_first_, const PeakIterator &scan_last_) const
 calculate mean & stdev of intensities of a spectrum More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. 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...
 
- Protected Attributes inherited from SignalToNoiseEstimator< MSSpectrum >
std::vector< double > stn_estimates_
 stores the noise estimate for each peak More...
 
- 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

template<typename Container = MSSpectrum>
class OpenMS::SignalToNoiseEstimatorMedian< Container >

Estimates the signal/noise (S/N) ratio of each data point in a scan by using the median (histogram based)

For each datapoint in the given scan, we collect a range of data points around it (param: win_len). The noise for a datapoint is estimated to be the median of the intensities of the current window. If the number of elements in the current window is not sufficient (param: MinReqElements), the noise level is set to a default value (param: noise_for_empty_window). The whole computation is histogram based, so the user will need to supply a number of bins (param: bin_count), which determines the level of error and runtime. The maximal intensity for a datapoint to be included in the histogram can be either determined automatically (params: AutoMaxIntensity, auto_mode) by two different methods or can be set directly by the user (param: max_intensity). If the (estimated) max_intensity value is too low and the median is found to be in the last (&highest) bin, a warning will be given. In this case you should increase max_intensity (and optionally the bin_count).

Changing any of the parameters will invalidate the S/N values (which will invoke a recomputation on the next request).

Note
If more than 20 percent of windows have less than min_required_elements of elements, a warning is issued to OPENMS_LOG_WARN and noise estimates in those windows are set to the constant noise_for_empty_window.
If more than 1 percent of median estimations had to rely on the last(=rightmost) bin (which gives an unreliable result), a warning is issued to OPENMS_LOG_WARN. In this case you should increase max_intensity (and optionally the bin_count).
You can disable logging this error by setting write_log_messages and read out the values
Parameters of this class are:

NameTypeDefaultRestrictionsDescription
max_intensity int-1 min: -1maximal intensity considered for histogram construction. By default, it will be calculated automatically (see auto_mode). Only provide this parameter if you know what you are doing (and change 'auto_mode' to '-1')! All intensities EQUAL/ABOVE 'max_intensity' will be added to the LAST histogram bin. If you choose 'max_intensity' too small, the noise estimate might be too small as well. If chosen too big, the bins become quite large (which you could counter by increasing 'bin_count', which increases runtime). In general, the Median-S/N estimator is more robust to a manual max_intensity than the MeanIterative-S/N.
auto_max_stdev_factor float3.0 min: 0.0 max: 999.0parameter for 'max_intensity' estimation (if 'auto_mode' == 0): mean + 'auto_max_stdev_factor' * stdev
auto_max_percentile int95 min: 0 max: 100parameter for 'max_intensity' estimation (if 'auto_mode' == 1): auto_max_percentile th percentile
auto_mode int0 min: -1 max: 1method to use to determine maximal intensity: -1 --> use 'max_intensity'; 0 --> 'auto_max_stdev_factor' method (default); 1 --> 'auto_max_percentile' method
win_len float200.0 min: 1.0window length in Thomson
bin_count int30 min: 3number of bins for intensity values
min_required_elements int10 min: 1minimum number of elements required in a window (otherwise it is considered sparse)
noise_for_empty_window float1.0e20  noise value used for sparse windows
write_log_messages stringtrue true, falseWrite out log messages in case of sparse windows or median in rightmost histogram bin

Note:
  • If a section name is documented, the documentation is displayed as tooltip.
  • Advanced parameter names are italic.

Member Typedef Documentation

◆ GaussianEstimate

◆ PeakIterator

◆ PeakType

Member Enumeration Documentation

◆ IntensityThresholdCalculation

method to use for estimating the maximal intensity that is used for histogram calculation

Enumerator
MANUAL 
AUTOMAXBYSTDEV 
AUTOMAXBYPERCENT 

Constructor & Destructor Documentation

◆ SignalToNoiseEstimatorMedian() [1/2]

◆ SignalToNoiseEstimatorMedian() [2/2]

◆ ~SignalToNoiseEstimatorMedian()

~SignalToNoiseEstimatorMedian ( )
inlineoverride

Destructor.

Member Function Documentation

◆ computeSTN_()

◆ getHistogramRightmostPercent()

double getHistogramRightmostPercent ( ) const
inline

Returns the percentage where the median was found in the rightmost bin.

References SignalToNoiseEstimatorMedian< Container >::histogram_oob_percent_.

◆ getSparseWindowPercent()

double getSparseWindowPercent ( ) const
inline

Returns how many percent of the windows were sparse.

References SignalToNoiseEstimatorMedian< Container >::sparse_window_percent_.

◆ operator=()

◆ updateMembers_()

Member Data Documentation

◆ auto_max_percentile_

double auto_max_percentile_
protected

parameter for initial automatic estimation of "max_intensity_" percentile or a stdev

Referenced by SignalToNoiseEstimatorMedian< Container >::computeSTN_(), and SignalToNoiseEstimatorMedian< Container >::updateMembers_().

◆ auto_max_stdev_Factor_

double auto_max_stdev_Factor_
protected

parameter for initial automatic estimation of "max_intensity_": a stdev multiplier

Referenced by SignalToNoiseEstimatorMedian< Container >::computeSTN_(), and SignalToNoiseEstimatorMedian< Container >::updateMembers_().

◆ auto_mode_

int auto_mode_
protected

determines which method shall be used for estimating "max_intensity_". valid are MANUAL=-1, AUTOMAXBYSTDEV=0 or AUTOMAXBYPERCENT=1

Referenced by SignalToNoiseEstimatorMedian< Container >::computeSTN_(), and SignalToNoiseEstimatorMedian< Container >::updateMembers_().

◆ bin_count_

int bin_count_
protected

◆ histogram_oob_percent_

◆ max_intensity_

double max_intensity_
protected

maximal intensity considered during binning (values above get discarded)

Referenced by SignalToNoiseEstimatorMedian< Container >::computeSTN_(), and SignalToNoiseEstimatorMedian< Container >::updateMembers_().

◆ min_required_elements_

int min_required_elements_
protected

minimal number of elements a window needs to cover to be used

Referenced by SignalToNoiseEstimatorMedian< Container >::computeSTN_(), and SignalToNoiseEstimatorMedian< Container >::updateMembers_().

◆ noise_for_empty_window_

double noise_for_empty_window_
protected

used as noise value for windows which cover less than "min_required_elements_" use a very high value if you want to get a low S/N result

Referenced by SignalToNoiseEstimatorMedian< Container >::computeSTN_(), and SignalToNoiseEstimatorMedian< Container >::updateMembers_().

◆ sparse_window_percent_

◆ win_len_

double win_len_
protected

range of data points which belong to a window in Thomson

Referenced by SignalToNoiseEstimatorMedian< Container >::computeSTN_(), and SignalToNoiseEstimatorMedian< Container >::updateMembers_().

◆ write_log_messages_