OpenMS
SpectraSTSimilarityScore Class Reference

Similarity score of SpectraST. More...

#include <OpenMS/COMPARISON/SPECTRA/SpectraSTSimilarityScore.h>

Inheritance diagram for SpectraSTSimilarityScore:
[legend]
Collaboration diagram for SpectraSTSimilarityScore:
[legend]

Public Member Functions

 SpectraSTSimilarityScore ()
 default constructor More...
 
 SpectraSTSimilarityScore (const SpectraSTSimilarityScore &source)
 copy constructor More...
 
 ~SpectraSTSimilarityScore () override
 destructor More...
 
SpectraSTSimilarityScoreoperator= (const SpectraSTSimilarityScore &source)
 assignment operator More...
 
double operator() (const PeakSpectrum &spec1, const PeakSpectrum &spec2) const override
 : calculates the dot product of the two spectra More...
 
double operator() (const BinnedSpectrum &bin1, const BinnedSpectrum &bin2) const
 : calculates the dot product of the two spectra More...
 
double operator() (const PeakSpectrum &spec) const override
 : calculates the dot product of itself More...
 
bool preprocess (PeakSpectrum &spec, float remove_peak_intensity_threshold=2.01, UInt cut_peaks_below=1000, Size min_peak_number=5, Size max_peak_number=150)
 Preprocesses the spectrum. More...
 
BinnedSpectrum transform (const PeakSpectrum &spec)
 spectrum is transformed into a binned spectrum with bin size 1 and spread 1 and the intensities are normalized. More...
 
double dot_bias (const BinnedSpectrum &bin1, const BinnedSpectrum &bin2, double dot_product=-1) const
 Calculates how much of the dot product is dominated by a few peaks. More...
 
double delta_D (double top_hit, double runner_up)
 calculates the normalized distance between top_hit and runner_up. More...
 
double compute_F (double dot_product, double delta_D, double dot_bias)
 computes the overall all score More...
 
- Public Member Functions inherited from PeakSpectrumCompareFunctor
 PeakSpectrumCompareFunctor ()
 default constructor More...
 
 PeakSpectrumCompareFunctor (const PeakSpectrumCompareFunctor &source)
 copy constructor More...
 
 ~PeakSpectrumCompareFunctor () override
 destructor More...
 
PeakSpectrumCompareFunctoroperator= (const PeakSpectrumCompareFunctor &source)
 assignment operator 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...
 
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...
 

Static Public Member Functions

static PeakSpectrumCompareFunctorcreate ()
 
static const String getProductName ()
 Reimplemented from PeakSpectrumCompareFunctor. More...
 
- Static Public Member Functions inherited from PeakSpectrumCompareFunctor
static void registerChildren ()
 registers all derived products More...
 
static const String getProductName ()
 
- 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...
 

Additional Inherited Members

- 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...
 
- 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...
 

Detailed Description

Similarity score of SpectraST.

Unlike the other similarity scores this score is used for matching a spectrum against a whole library, although the dot product seems to be an effective method for scoring on its own. For calculating the SpectraST score, first preprocess the spectra if not already done. Transform them and calculate the dot product and the dot bias. Afterwards get the best two hits and calculate delta_D. Now for every spectrum from the library you can calculate the final score.

The details of the score can be found in: H. Lam et al., Development and validation of a spectral library searching method for peptide identification from MS/MS, Proteomics, 7 , 655-667, 2007

Constructor & Destructor Documentation

◆ SpectraSTSimilarityScore() [1/2]

default constructor

◆ SpectraSTSimilarityScore() [2/2]

copy constructor

◆ ~SpectraSTSimilarityScore()

~SpectraSTSimilarityScore ( )
override

destructor

Member Function Documentation

◆ compute_F()

double compute_F ( double  dot_product,
double  delta_D,
double  dot_bias 
)

computes the overall all score

Parameters
dot_productof a match
delta_Dshould be calculated after all dot products for a unidentified spectrum are computed
dot_bias
Returns
the SpectraST similarity score

◆ create()

static PeakSpectrumCompareFunctor* create ( )
inlinestatic

◆ delta_D()

double delta_D ( double  top_hit,
double  runner_up 
)

calculates the normalized distance between top_hit and runner_up.

Parameters
top_hitis the best score for a given match.
runner_upa match with a worse score than top_hit, e.g. the second best score.
Returns
normalized distance
Exceptions
DividedByZeroexception if top_hit is 0.
Note
Range of the dot products is between 0 and 1.

◆ dot_bias()

double dot_bias ( const BinnedSpectrum bin1,
const BinnedSpectrum bin2,
double  dot_product = -1 
) const

Calculates how much of the dot product is dominated by a few peaks.

Parameters
dot_productif -1 this value will be calculated as well.
bin1first spectrum in binned representation
bin2second spectrum in binned representation

◆ getProductName()

static const String getProductName ( )
inlinestatic

Reimplemented from PeakSpectrumCompareFunctor.

◆ operator()() [1/3]

double operator() ( const BinnedSpectrum bin1,
const BinnedSpectrum bin2 
) const

: calculates the dot product of the two spectra

◆ operator()() [2/3]

double operator() ( const PeakSpectrum spec) const
overridevirtual

: calculates the dot product of itself

Implements PeakSpectrumCompareFunctor.

◆ operator()() [3/3]

double operator() ( const PeakSpectrum spec1,
const PeakSpectrum spec2 
) const
overridevirtual

: calculates the dot product of the two spectra

Implements PeakSpectrumCompareFunctor.

◆ operator=()

SpectraSTSimilarityScore& operator= ( const SpectraSTSimilarityScore source)

assignment operator

◆ preprocess()

bool preprocess ( PeakSpectrum spec,
float  remove_peak_intensity_threshold = 2.01,
UInt  cut_peaks_below = 1000,
Size  min_peak_number = 5,
Size  max_peak_number = 150 
)

Preprocesses the spectrum.

The preprocessing removes peak below a intensity threshold, reject spectra that does not have enough peaks, and cuts peaks exceeding the max_peak_number most intense peaks.

Returns
true if spectrum passes filtering

◆ transform()

BinnedSpectrum transform ( const PeakSpectrum spec)

spectrum is transformed into a binned spectrum with bin size 1 and spread 1 and the intensities are normalized.