56 template <
typename SpectrumType>
59 double tolerance = (double)param_.getValue(
"tolerance");
63 for (
Size i = 0; i < spectrum.size(); ++i)
66 for (
Size j = i; i + j < spectrum.size(); ++j)
68 double diff = spectrum[i + j].getPosition()[0] - spectrum[i].getPosition()[0];
80 totaldiff += spectrum[i + j].getIntensity() + spectrum[i].getIntensity();
81 std::map<double, char>::const_iterator aait = aamass_.lower_bound(diff);
82 if (aait == aamass_.end())
87 if (fabs(aait->first - diff) <= tolerance)
89 gooddiff += spectrum[i + j].getIntensity() + spectrum[i].getIntensity();
94 if ((aait) != aamass_.end() && fabs((aait)->first - diff) <= tolerance)
96 gooddiff += spectrum[i + j].getIntensity() + spectrum[i].getIntensity();
103 return gooddiff / totaldiff;
109 return "GoodDiffFilter";
A FilterFunctor extracts some spectrum characteristics for quality assessment.
Definition: FilterFunctor.h:20
GoodDiffFilter counts the number ob peak pairs whose m/z difference can be explained by a amino acid ...
Definition: GoodDiffFilter.h:29
~GoodDiffFilter() override
destructor
GoodDiffFilter()
default constructor
static FilterFunctor * create()
Definition: GoodDiffFilter.h:53
GoodDiffFilter & operator=(const GoodDiffFilter &source)
assignment operator
std::map< double, char > aamass_
list of unique amino acid masses
Definition: GoodDiffFilter.h:118
double apply(SpectrumType &spectrum)
Definition: GoodDiffFilter.h:57
GoodDiffFilter(const GoodDiffFilter &source)
copy constructor
static const String getProductName()
Definition: GoodDiffFilter.h:107
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22