OpenMS
SpectrumCheapDPCorr.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: $
7 // --------------------------------------------------------------------------
8 //
9 #pragma once
10 
13 
16 
17 #include <map>
18 
19 namespace OpenMS
20 {
21 
35  class OPENMS_DLLAPI SpectrumCheapDPCorr :
37  {
38 public:
39 
40  // @name Constructors and Destructors
41  // @{
44 
47 
50  // @}
51 
52  // @name Operators
53  // @{
56 
57  double operator()(const PeakSpectrum & a, const PeakSpectrum & b) const override;
58 
59  double operator()(const PeakSpectrum & a) const override;
60  // @}
61 
62  // @name Accessors
63  // @{
66 
68  static const String getProductName()
69  {
70  return "SpectrumCheapDPCorr";
71  }
72 
74  const PeakSpectrum & lastconsensus() const;
75 
77  std::map<UInt, UInt> getPeakMap() const;
78 
80  void setFactor(double f);
81  // @}
82 
83 private:
84 
86  double dynprog_(const PeakSpectrum &, const PeakSpectrum &, int, int, int, int) const;
87 
89  double comparepeaks_(double posa, double posb, double inta, double intb) const;
90 
91  static const String info_;
92 
95 
97  bool keeppeaks_;
98 
100  mutable double factor_;
101 
103  mutable std::map<UInt, UInt> peak_map_;
104  };
105 
106 }
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
Base class for compare functors of spectra, that return a similarity value for two spectra.
Definition: PeakSpectrumCompareFunctor.h:28
SpectrumCheapDPCorr calculates an optimal alignment on stick spectra.
Definition: SpectrumCheapDPCorr.h:37
void setFactor(double f)
set weighting of the second spectrum for consensus from next function call operator
double operator()(const PeakSpectrum &a, const PeakSpectrum &b) const override
function call operator, calculates the similarity
std::map< UInt, UInt > getPeakMap() const
static const String info_
Definition: SpectrumCheapDPCorr.h:91
SpectrumCheapDPCorr(const SpectrumCheapDPCorr &source)
copy constructor
double comparepeaks_(double posa, double posb, double inta, double intb) const
similarity of two peaks
bool keeppeaks_
should peaks with no alignment partner be kept in the consensus?
Definition: SpectrumCheapDPCorr.h:97
~SpectrumCheapDPCorr() override
destructor
std::map< UInt, UInt > peak_map_
last peak map
Definition: SpectrumCheapDPCorr.h:103
double operator()(const PeakSpectrum &a) const override
calculates self similarity
double factor_
weighting factor for the next consensus spectrum
Definition: SpectrumCheapDPCorr.h:100
SpectrumCheapDPCorr()
default constructor
SpectrumCheapDPCorr & operator=(const SpectrumCheapDPCorr &source)
assignment operator
const PeakSpectrum & lastconsensus() const
return consensus spectrum from last function call operator
static PeakSpectrumCompareFunctor * create()
Definition: SpectrumCheapDPCorr.h:65
static const String getProductName()
Definition: SpectrumCheapDPCorr.h:68
double dynprog_(const PeakSpectrum &, const PeakSpectrum &, int, int, int, int) const
O(n^2) dynamical programming.
PeakSpectrum lastconsensus_
consensus spectrum of the last comparison
Definition: SpectrumCheapDPCorr.h:94
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22