57 template <
typename SpectrumType>
63 c1_ = (double)param_.getValue(
"C1");
64 c2_ = (double)param_.getValue(
"C2");
65 th_ = (double)param_.getValue(
"threshold");
71 std::map<double, Size> peakranks;
72 for (ConstIterator it = spectrum.begin(); it != spectrum.end(); ++it)
74 peakranks[it->getIntensity()] = 0;
75 if (it->getIntensity() > maxint)
77 maxint = it->getIntensity();
81 for (std::map<double, Size>::reverse_iterator mit = peakranks.rbegin(); mit != peakranks.rend(); ++mit)
88 for (
SignedSize i = spectrum.size() - 1; i >= 0; --i)
90 if (spectrum[i].getIntensity() > maxint * th_)
92 maxmz = spectrum[i].getMZ();
98 for (
Iterator it = spectrum.begin(); it != spectrum.end(); )
100 double newint = c1_ - (c2_ / maxmz) * peakranks[it->getIntensity()];
103 it = spectrum.erase(it);
107 it->setIntensity(newint);
BernNorm scales the peaks by ranking them and then scaling them according to rank.
Definition: BernNorm.h:32
double th_
Definition: BernNorm.h:122
void filterPeakSpectrum(PeakSpectrum &spectrum)
void filterPeakMap(PeakMap &exp)
BernNorm & operator=(const BernNorm &source)
assignment operator
double c2_
Definition: BernNorm.h:121
~BernNorm() override
destructor
void filterSpectrum(SpectrumType &spectrum)
Definition: BernNorm.h:58
double c1_
Definition: BernNorm.h:120
BernNorm(const BernNorm &source)
copy constructor
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:110
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:108
void sortByPosition()
Lexicographically sorts the peaks by their position.
unsigned int UInt
Unsigned integer type.
Definition: Types.h:68
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:108
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22