Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
FeatureFindingMetabo.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Erhan Kenar, Holger Franken $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_FILTERING_DATAREDUCTION_FEATUREFINDINGMETABO_H
36 #define OPENMS_FILTERING_DATAREDUCTION_FEATUREFINDINGMETABO_H
37 
43 
44 #include <vector>
45 #include <svm.h>
46 
47 namespace OpenMS
48 {
49 
58  class OPENMS_DLLAPI FeatureHypothesis
59  {
60 public:
63 
66 
69 
71  FeatureHypothesis& operator=(const FeatureHypothesis& rhs);
72 
73  // getter & setter
74  Size getSize() const;
75 
76  String getLabel() const;
77 
78  std::vector<String> getLabels() const;
79 
80  double getScore() const;
81 
82  void setScore(const double& score);
83 
84  SignedSize getCharge() const;
85 
86  void setCharge(const SignedSize& ch);
87 
88  std::vector<double> getAllIntensities(bool smoothed = false) const;
89 
90  std::vector<double> getIsotopeDistances() const;
91 
92  double getCentroidMZ() const;
93 
94  double getCentroidRT() const;
95 
96  double getFWHM() const;
97 
99  void addMassTrace(const MassTrace&);
100  double getMonoisotopicFeatureIntensity(bool) const;
101  double getSummedFeatureIntensity(bool) const;
102 
103  Size getNumFeatPoints() const;
104  std::vector<ConvexHull2D> getConvexHulls() const;
105  std::vector< OpenMS::MSChromatogram > getChromatograms(UInt64 feature_id) const;
106 
107 private:
108 
109  // pointers of MassTraces contained in isotopic pattern
110  std::vector<const MassTrace*> iso_pattern_;
111 
112  double feat_score_;
113 
115  };
116 
117  class OPENMS_DLLAPI CmpMassTraceByMZ
118  {
119 public:
120 
121  bool operator()(const MassTrace& x, const MassTrace& y) const
122  {
123  return x.getCentroidMZ() < y.getCentroidMZ();
124  }
125 
126  };
127 
128  class OPENMS_DLLAPI CmpHypothesesByScore
129  {
130 public:
131 
132  bool operator()(const FeatureHypothesis& x, const FeatureHypothesis& y) const
133  {
134  return x.getScore() > y.getScore();
135  }
136 
137  };
138 
164  class OPENMS_DLLAPI FeatureFindingMetabo :
165  public DefaultParamHandler,
166  public ProgressLogger
167  {
168 public:
171 
173  virtual ~FeatureFindingMetabo();
174 
176  void run(std::vector<MassTrace>& input_mtraces, FeatureMap& output_featmap, std::vector<std::vector< OpenMS::MSChromatogram > >& output_chromatograms);
177 
178 protected:
179  virtual void updateMembers_();
180 
181 private:
190  double computeCosineSim_(const std::vector<double>&, const std::vector<double>&) const;
191 
194  double computeOLSCoeff_(const std::vector<double>&, const std::vector<double>&) const;
195 
208  int isLegalIsotopePattern_(const FeatureHypothesis& feat_hypo) const;
209 
210  void loadIsotopeModel_(const String&);
211 
232  double scoreMZ_(const MassTrace &, const MassTrace &, Size isotopic_position, Size charge) const;
233 
246  double scoreRT_(const MassTrace&, const MassTrace&) const;
247 
254  double computeAveragineSimScore_(const std::vector<double>& intensities, const double& molecular_weight) const;
255 
264  void findLocalFeatures_(const std::vector<const MassTrace*>& candidates, const double total_intensity, std::vector<FeatureHypothesis>& output_hypotheses) const;
265 
267  svm_model* isotope_filt_svm_;
268  std::vector<double> svm_feat_centers_;
269  std::vector<double> svm_feat_scales_;
270 
272 
278  double chrom_fwhm_;
279 
284 
288  };
289 
290 }
291 
292 #endif // OPENMS_FILTERING_DATAREDUCTION_FEATUREFINDINGMETABO_H
A more convenient string class.
Definition: String.h:57
Definition: FeatureFindingMetabo.h:128
double local_mz_range_
Definition: FeatureFindingMetabo.h:275
A container for features.
Definition: FeatureMap.h:94
String isotope_filtering_model_
Definition: FeatureFindingMetabo.h:282
bool operator()(const MassTrace &x, const MassTrace &y) const
Definition: FeatureFindingMetabo.h:121
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:135
std::vector< const MassTrace * > iso_pattern_
Definition: FeatureFindingMetabo.h:110
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
bool use_smoothed_intensities_
Definition: FeatureFindingMetabo.h:283
Internal structure used in FeatureFindingMetabo that keeps track of a feature hypothesis (isotope gro...
Definition: FeatureFindingMetabo.h:58
double local_rt_range_
parameter stuff
Definition: FeatureFindingMetabo.h:274
double chrom_fwhm_
Definition: FeatureFindingMetabo.h:278
double getCentroidMZ() const
Returns the centroid m/z.
Definition: MassTrace.h:179
bool enable_RT_filtering_
Definition: FeatureFindingMetabo.h:281
Definition: FeatureFindingMetabo.h:117
Size charge_upper_bound_
Definition: FeatureFindingMetabo.h:277
Size charge_lower_bound_
Definition: FeatureFindingMetabo.h:276
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:78
bool use_mz_scoring_C13_
Definition: FeatureFindingMetabo.h:285
SignedSize charge_
Definition: FeatureFindingMetabo.h:114
double feat_score_
Definition: FeatureFindingMetabo.h:112
bool report_chromatograms_
Definition: FeatureFindingMetabo.h:287
bool report_summed_ints_
Definition: FeatureFindingMetabo.h:280
std::vector< double > svm_feat_centers_
Definition: FeatureFindingMetabo.h:268
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
double total_intensity_
Definition: FeatureFindingMetabo.h:271
bool report_convex_hulls_
Definition: FeatureFindingMetabo.h:286
svm_model * isotope_filt_svm_
SVM parameters.
Definition: FeatureFindingMetabo.h:267
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
bool operator()(const FeatureHypothesis &x, const FeatureHypothesis &y) const
Definition: FeatureFindingMetabo.h:132
std::vector< double > svm_feat_scales_
Definition: FeatureFindingMetabo.h:269
A container type that gathers peaks similar in m/z and moving along retention time.
Definition: MassTrace.h:62
Method for the assembly of mass traces belonging to the same isotope pattern, i.e., that are compatible in retention times, mass-to-charge ratios, and isotope abundances.
Definition: FeatureFindingMetabo.h:164

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:00 using doxygen 1.8.13