35 #ifndef OPENMS_FILTERING_TRANSFORMERS_BERNNORM_H 36 #define OPENMS_FILTERING_TRANSFORMERS_BERNNORM_H 84 template <
typename SpectrumType>
90 c1_ = (
double)param_.getValue(
"C1");
91 c2_ = (
double)param_.getValue(
"C2");
92 th_ = (
double)param_.getValue(
"threshold");
98 std::map<double, Size> peakranks;
99 for (ConstIterator it = spectrum.begin(); it != spectrum.end(); ++it)
101 peakranks[it->getIntensity()] = 0;
102 if (it->getIntensity() > maxint)
104 maxint = it->getIntensity();
108 for (std::map<double, Size>::reverse_iterator mit = peakranks.rbegin(); mit != peakranks.rend(); ++mit)
110 mit->second = ++rank;
115 for (
SignedSize i = spectrum.size() - 1; i >= 0; --i)
117 if (spectrum[i].getIntensity() > maxint * th_)
119 maxmz = spectrum[i].getMZ();
125 for (Iterator it = spectrum.begin(); it != spectrum.end(); )
127 double newint = c1_ - (c2_ / maxmz) * peakranks[it->getIntensity()];
130 it = spectrum.erase(it);
134 it->setIntensity(newint);
143 void filterPeakMap(
PeakMap & exp);
157 #endif //OPENMS_FILTERING_TRANSFORMERS_BERNNORM_H double th_
Definition: BernNorm.h:149
void sortByPosition()
Lexicographically sorts the peaks by their position.
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:104
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:135
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:102
double c2_
Definition: BernNorm.h:148
BernNorm scales the peaks by ranking them and then scaling them according to rank.
Definition: BernNorm.h:57
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
void filterSpectrum(SpectrumType &spectrum)
Definition: BernNorm.h:85
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
double c1_
Definition: BernNorm.h:147
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92