OpenMS
Loading...
Searching...
No Matches
TargetedSpectraExtractor::Comparator Class Referenceabstract

Abstract base interface for spectral-library scoring strategies consumed by matchSpectrum. More...

#include <OpenMS/ANALYSIS/OPENSWATH/TargetedSpectraExtractor.h>

Inheritance diagram for TargetedSpectraExtractor::Comparator:
[legend]
Collaboration diagram for TargetedSpectraExtractor::Comparator:
[legend]

Public Member Functions

virtual ~Comparator ()=default
 
virtual void generateScores (const MSSpectrum &spec, std::vector< std::pair< Size, double > > &scores, double min_score) const =0
 Score spec against every entry of the cached library; keep only matches >= min_score.
 
virtual void init (const std::vector< MSSpectrum > &library, const std::map< std::string, DataValue > &options)=0
 Load the reference library and (re)configure the comparator.
 
const std::vector< MSSpectrum > & getLibrary () const
 Return the reference library passed to the most recent init call.
 

Protected Attributes

std::vector< MSSpectrumlibrary_
 

Detailed Description

Abstract base interface for spectral-library scoring strategies consumed by matchSpectrum.

Implementations cache a reference library on init and then score query spectra against it via generateScores. The scoring direction is "higher is better" — the matchSpectrum caller sorts the returned pairs by descending score and keeps the top entries. Implementations are free to interpret the options map however they see fit; the caller passes user-supplied parameters through verbatim.

Constructor & Destructor Documentation

◆ ~Comparator()

virtual ~Comparator ( )
virtualdefault

Member Function Documentation

◆ generateScores()

virtual void generateScores ( const MSSpectrum spec,
std::vector< std::pair< Size, double > > &  scores,
double  min_score 
) const
pure virtual

Score spec against every entry of the cached library; keep only matches >= min_score.

Parameters
[in]specQuery spectrum.
[out]scores(library_index, score) pairs for matches that clear the threshold; unsorted.
[in]min_scoreLower bound on the kept score (inclusive).

Implemented in TargetedSpectraExtractor::BinnedSpectrumComparator.

◆ getLibrary()

const std::vector< MSSpectrum > & getLibrary ( ) const
inline

Return the reference library passed to the most recent init call.

◆ init()

virtual void init ( const std::vector< MSSpectrum > &  library,
const std::map< std::string, DataValue > &  options 
)
pure virtual

Load the reference library and (re)configure the comparator.

Parameters
[in]libraryReference spectra to score against in subsequent generateScores calls.
[in]optionsImplementation-specific knobs. BinnedSpectrumComparator consults "bin_size", "peak_spread", "bin_offset" — see its override for details.

Implemented in TargetedSpectraExtractor::BinnedSpectrumComparator.

Member Data Documentation

◆ library_

std::vector<MSSpectrum> library_
protected