83 template <
typename SpectrumType>
89 c1_ = (double)param_.getValue(
"C1");
90 c2_ = (double)param_.getValue(
"C2");
91 th_ = (double)param_.getValue(
"threshold");
97 std::map<double, Size> peakranks;
98 for (ConstIterator it = spectrum.begin(); it != spectrum.end(); ++it)
100 peakranks[it->getIntensity()] = 0;
101 if (it->getIntensity() > maxint)
103 maxint = it->getIntensity();
107 for (std::map<double, Size>::reverse_iterator mit = peakranks.rbegin(); mit != peakranks.rend(); ++mit)
109 mit->second = ++rank;
114 for (
SignedSize i = spectrum.size() - 1; i >= 0; --i)
116 if (spectrum[i].getIntensity() > maxint * th_)
118 maxmz = spectrum[i].getMZ();
124 for (
Iterator it = spectrum.begin(); it != spectrum.end(); )
126 double newint = c1_ - (c2_ / maxmz) * peakranks[it->getIntensity()];
129 it = spectrum.erase(it);
133 it->setIntensity(newint);
BernNorm scales the peaks by ranking them and then scaling them according to rank.
Definition: BernNorm.h:58
double th_
Definition: BernNorm.h:148
void filterPeakSpectrum(PeakSpectrum &spectrum)
void filterPeakMap(PeakMap &exp)
BernNorm & operator=(const BernNorm &source)
assignment operator
double c2_
Definition: BernNorm.h:147
~BernNorm() override
destructor
void filterSpectrum(SpectrumType &spectrum)
Definition: BernNorm.h:84
double c1_
Definition: BernNorm.h:146
BernNorm(const BernNorm &source)
copy constructor
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:73
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:130
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:128
void sortByPosition()
Lexicographically sorts the peaks by their position.
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47