OpenMS
FeatureFinderAlgorithmPickedHelperStructs.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Marc Sturm, Stephan Aiche $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/CONCEPT/Types.h>
13 
15 #include <OpenMS/KERNEL/Peak1D.h>
16 
17 #include <vector>
18 #include <list>
19 #include <cmath>
20 
21 namespace OpenMS
22 {
23 
31  {
32 
36  struct OPENMS_DLLAPI Seed
37  {
43  float intensity;
44 
46  bool operator<(const Seed& rhs) const;
47 
48  };
49 
53  struct OPENMS_DLLAPI MassTrace
54  {
56  const Peak1D* max_peak;
58  double max_rt;
59 
62 
64  std::vector<std::pair<double, const Peak1D*> > peaks;
65 
68 
70  void updateMaximum();
71 
73  double getAvgMZ() const;
74 
76  bool isValid() const;
77 
78  };
79 
83  struct OPENMS_DLLAPI MassTraces :
84  private std::vector<MassTrace>
85  {
86  typedef std::vector<MassTrace> privvec;
87 
88  // public exports of used methods
89  using privvec::size;
90  using privvec::at;
91  using privvec::reserve;
92  using privvec::push_back;
93  using privvec::operator[];
94  using privvec::back;
95  using privvec::clear;
96  using privvec::begin;
97  using privvec::end;
98  typedef privvec::iterator iterator;
99  typedef privvec::const_iterator const_iterator;
100 
103 
106 
108  bool isValid(double seed_mz, double trace_tolerance);
109 
116 
119 
125  std::pair<double, double> getRTBounds() const;
126 
136  void computeIntensityProfile(std::list<std::pair<double, double> >& intensity_profile) const;
137 
141  double baseline;
142  };
143 
147  struct OPENMS_DLLAPI TheoreticalIsotopePattern
148  {
150  std::vector<double> intensity;
156  double max;
160  Size size() const;
161 
162  };
163 
167  struct OPENMS_DLLAPI IsotopePattern
168  {
170  std::vector<SignedSize> peak;
172  std::vector<Size> spectrum;
174  std::vector<double> intensity;
176  std::vector<double> mz_score;
178  std::vector<double> theoretical_mz;
181 
183  explicit IsotopePattern(Size size);
184 
185  };
186 
187  };
188 }
189 
A 2-dimensional hull representation in [counter]clockwise direction - depending on axis labelling.
Definition: ConvexHull2D.h:47
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:28
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
Wrapper struct for all the classes needed by the FeatureFinderAlgorithmPicked and the associated clas...
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:31
Helper structure for a found isotope pattern used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:168
TheoreticalIsotopePattern theoretical_pattern
Theoretical isotope pattern.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:180
std::vector< Size > spectrum
Spectrum index (undefined if peak index is -1 or -2)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:172
std::vector< double > mz_score
m/z score of peak (0 if peak index is -1 or -2)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:176
std::vector< double > theoretical_mz
Theoretical m/z value of the isotope peak.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:178
std::vector< double > intensity
Peak intensity (0 if peak index is -1 or -2)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:174
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:170
IsotopePattern(Size size)
Constructor that resizes the internal vectors.
Helper struct for mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:54
bool isValid() const
Checks if this Trace is valid (has more than 2 points)
std::vector< std::pair< double, const Peak1D * > > peaks
Contained peaks (pair of RT and pointer to peak)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:64
const Peak1D * max_peak
Maximum peak pointer.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:56
double max_rt
RT of maximum peak.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:58
double getAvgMZ() const
Returns the average m/z of all peaks in this trace (weighted by intensity)
double theoretical_int
Theoretical intensity value (scaled to [0,1])
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:61
void updateMaximum()
Sets the maximum to the highest contained peak of the trace.
ConvexHull2D getConvexhull() const
determines the convex hull of the trace
Helper struct for a collection of mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:85
bool isValid(double seed_mz, double trace_tolerance)
Checks if still valid (seed still contained and enough traces)
std::vector< MassTrace > privvec
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:86
privvec::const_iterator const_iterator
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:99
Size getTheoreticalmaxPosition() const
Returns the theoretical maximum trace index.
Size getPeakCount() const
Returns the peak count of all traces.
std::pair< double, double > getRTBounds() const
Returns the RT boundaries of the mass traces.
privvec::iterator iterator
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:98
void updateBaseline()
Sets the baseline to the lowest contained peak of the trace.
Size max_trace
Maximum intensity trace.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:139
double baseline
Estimated baseline in the region of the feature (used for the fit)
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:141
void computeIntensityProfile(std::list< std::pair< double, double > > &intensity_profile) const
Computes a flat representation of MassTraces, i.e., a single intensity value for each point in RT....
Helper structure for seeds used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:37
float intensity
Intensity.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:43
bool operator<(const Seed &rhs) const
Comparison operator.
Size spectrum
Spectrum index.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:39
Size peak
Peak index.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:41
Helper structure for a theoretical isotope pattern used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:148
double max
The maximum intensity contribution before scaling the pattern to 1.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:156
Size optional_end
Number of optional peaks at the end of the pattern.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:154
std::vector< double > intensity
Vector of intensity contributions.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:150
Size trimmed_left
The number of isotopes trimmed on the left side. This is needed to reconstruct the monoisotopic peak.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:158
Size optional_begin
Number of optional peaks at the beginning of the pattern.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:152