35 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEATUREFINDERALGORITHMPICKEDHELPERSTRUCTS_H
36 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEATUREFINDERALGORITHMPICKEDHELPERSTRUCTS_H
82 template <
class PeakType>
94 std::vector<std::pair<DoubleReal, const PeakType *> >
peaks;
100 for (
Size i = 0; i < peaks.size(); ++i)
102 hull_points[i][0] = peaks[i].first;
103 hull_points[i][1] = peaks[i].second->getMZ();
113 if (peaks.empty())
return;
115 max_rt = peaks.begin()->first;
116 max_peak = peaks.begin()->second;
118 for (
Size i = 1; i < peaks.size(); ++i)
120 if (peaks[i].second->getIntensity() > max_peak->getIntensity())
122 max_rt = peaks[i].first;
123 max_peak = peaks[i].second;
133 for (
Size i = 0; i < peaks.size(); ++i)
135 sum += peaks[i].second->getMZ() * peaks[i].second->getIntensity();
136 intensities += peaks[i].second->getIntensity();
138 return sum / intensities;
144 return peaks.size() >= 3;
152 template <
class PeakType>
154 public std::vector<MassTrace<PeakType> >
166 for (
Size i = 0; i < this->size(); ++i)
168 sum += this->at(i).peaks.size();
177 if (this->size() < 2)
return false;
180 for (
Size j = 0; j < this->size(); ++j)
182 if (std::fabs(seed_mz - this->at(j).getAvgMZ()) <= trace_tolerance)
199 throw Exception::Precondition(__FILE__, __LINE__, __PRETTY_FUNCTION__,
"There must be at least one trace to determine the theoretical maximum trace!");
203 DoubleReal max_int = this->at(0).theoretical_int;
204 for (
Size i = 1; i < this->size(); ++i)
206 if (this->at(i).theoretical_int > max_int)
208 max_int = this->at(i).theoretical_int;
218 if (this->size() == 0)
224 for (
Size i = 0; i < this->size(); ++i)
226 for (
Size j = 0; j < this->at(i).peaks.size(); ++j)
230 baseline = this->at(i).peaks[j].second->getIntensity();
233 if (this->at(i).peaks[j].second->getIntensity() < baseline)
235 baseline = this->at(i).peaks[j].second->getIntensity();
250 throw Exception::Precondition(__FILE__, __LINE__, __PRETTY_FUNCTION__,
"There must be at least one trace to determine the RT boundaries!");
253 DoubleReal min = std::numeric_limits<DoubleReal>::max();
254 DoubleReal max = -std::numeric_limits<DoubleReal>::max();
256 for (
Size i = 0; i < this->size(); ++i)
258 for (
Size j = 0; j < this->at(i).peaks.size(); ++j)
261 if (rt > max) max = rt;
262 if (rt < min) min = rt;
265 return std::make_pair(min, max);
292 return intensity.size();
330 #endif // #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEATUREFINDERALGORITHMPICKEDHELPERSTRUCTS_H
MassTraces()
Constructor.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:157
float Real
Real type.
Definition: Types.h:109
Size spectrum
Spectrum index.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:65
void updateMaximum()
Sets the maximum to the highest contained peak of the trace.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:111
A 2-dimensional raw data point or peak.
Definition: Peak2D.h:55
static DoubleReal sum(IteratorType begin, IteratorType end)
Calculates the sum of a range of values.
Definition: StatisticFunctions.h:56
Size max_trace
Maximum intensity trace.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:269
Helper struct for a collection of mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:153
bool isValid(DoubleReal seed_mz, DoubleReal trace_tolerance)
Checks if still valid (seed still contained and enough traces)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:174
std::vector< PointType > PointArrayType
Definition: ConvexHull2D.h:79
Wrapper struct for all the classes needed by the FeatureFinderAlgorithmPicked and the associated clas...
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:56
Size optional_begin
Number of optional peaks at the beginning of the pattern.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:282
Helper structure for a theoretical isotope pattern used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:277
std::vector< DoubleReal > mz_score
m/z score of peak (0 if peak index is -1 or -2)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:309
Size size() const
Returns the size.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:290
std::vector< DoubleReal > intensity
Peak intensity (0 if peak index is -1 or -2)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:307
Size getPeakCount() const
Returns the peak count of all traces.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:163
Precondition failed exception.
Definition: Exception.h:167
IsotopePattern(Size size)
Constructor that resizes the internal vectors.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:316
std::vector< DoubleReal > theoretical_mz
Theoretical m/z value of the isotope peak.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:311
A 2-dimensional hull representation in [counter]clockwise direction - depending on axis labelling...
Definition: ConvexHull2D.h:75
TheoreticalIsotopePattern theoretical_pattern
Theoretical isotope pattern.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:313
const PeakType * max_peak
Maximum peak pointer.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:86
std::vector< Size > spectrum
Spectrum index (undefined if peak index is -1 or -2)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:305
bool isValid() const
Checks if this Trace is valid (has more than 2 points)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:142
DoubleReal max
The maximum intensity contribution before scaling the pattern to 1.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:286
DoubleReal theoretical_int
Theoretical intensity value (scaled to [0,1])
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:91
ConvexHull2D getConvexhull() const
determines the convex hull of the trace
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:97
bool operator<(const Seed &rhs) const
Comparison operator.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:72
DoubleReal baseline
Estimated baseline in the region of the feature (used for the fit)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:271
Helper structure for a found isotope pattern used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:300
DoubleReal max_rt
RT of maximum peak.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:88
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
std::vector< std::pair< DoubleReal, const PeakType * > > peaks
Contained peaks (pair of RT and pointer to peak)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:94
Size optional_end
Number of optional peaks at the end of the pattern.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:284
DoubleReal getAvgMZ() const
Returns the average m/z of all peaks in this trace (weighted by intensity)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:129
Size trimmed_left
The number of isotopes trimmed on the left side. This is needed to reconstruct the monoisotopic peak...
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:288
void addPoints(const PointArrayType &points)
Size getTheoreticalmaxPosition() const
Returns the theoretical maximum trace index.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:195
void updateBaseline()
Sets the baseline to the lowest contained peak of the trace.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:216
std::vector< DoubleReal > intensity
Vector of intensity contributions.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:280
std::pair< DoubleReal, DoubleReal > getRTBounds() const
Returns the RT boundaries of the mass traces.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:246
Size peak
Peak index.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:67
std::vector< SignedSize > peak
Peak index (-1 if peak was not found, -2 if it was removed to improve the isotope fit) ...
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:303
Real intensity
Intensity.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:69
Helper struct for mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:83
Helper structure for seeds used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:62