OpenMS  2.7.0
DIAScoring.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-2021.
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: Hannes Roest $
32 // $Authors: Hannes Roest, Witold Wolski $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <boost/math/special_functions/fpclassify.hpp> // for isnan
40 
45 
46 namespace OpenMS
47 {
48  class TheoreticalSpectrumGenerator;
49 
83  class OPENMS_DLLAPI DIAScoring :
84  public DefaultParamHandler
85  {
87 
93 
94 public:
95 
97 
98  DIAScoring();
100 
102  ~DIAScoring() override;
104 
106  // DIA / SWATH scoring
107 
109 
110  void dia_isotope_scores(const std::vector<TransitionType>& transitions,
112  SpectrumPtrType spectrum,
113  OpenSwath::IMRMFeature* mrmfeature,
114  double& isotope_corr,
115  double& isotope_overlap) const;
116 
118  void dia_massdiff_score(const std::vector<TransitionType>& transitions,
119  SpectrumPtrType spectrum,
120  const std::vector<double>& normalized_library_intensity,
121  double& ppm_score,
122  double& ppm_score_weighted,
123  std::vector<double>& diff_ppm) const;
124 
133  bool dia_ms1_massdiff_score(double precursor_mz, SpectrumPtrType spectrum,
134  double& ppm_score) const;
135 
137  void dia_ms1_isotope_scores_averagine(double precursor_mz, SpectrumPtrType spectrum,
138  double& isotope_corr, double& isotope_overlap, int charge_state) const;
139  void dia_ms1_isotope_scores(double precursor_mz, SpectrumPtrType spectrum,
140  double& isotope_corr, double& isotope_overlap, const EmpiricalFormula& sum_formula) const;
141 
142 
144  void dia_by_ion_score(SpectrumPtrType spectrum, AASequence& sequence,
145  int charge, double& bseries_score, double& yseries_score) const;
146 
149  const std::vector<TransitionType>& transitions,
150  double& dotprod,
151  double& manhattan) const;
153 
154 private:
155 
157  DIAScoring(const DIAScoring& rhs);
158 
161 
163  void updateMembers_() override;
164 
166  void diaIsotopeScoresSub_(const std::vector<TransitionType>& transitions,
167  SpectrumPtrType spectrum,
168  std::map<std::string, double>& intensities,
169  double& isotope_corr,
170  double& isotope_overlap) const;
171 
174  void getFirstIsotopeRelativeIntensities_(const std::vector<TransitionType>& transitions,
175  OpenSwath::IMRMFeature* mrmfeature,
176  std::map<std::string, double>& intensities //experimental intensities of transitions
177  ) const;
178 
179 private:
180 
196  void largePeaksBeforeFirstIsotope_(SpectrumPtrType spectrum, double mono_mz, double mono_int, int& nr_occurrences, double& max_ratio) const;
197 
206  double scoreIsotopePattern_(const std::vector<double>& isotopes_int,
207  double product_mz,
208  int putative_fragment_charge) const;
209 
217  double scoreIsotopePattern_(const std::vector<double>& isotopes_int,
218  const EmpiricalFormula& sum_formula) const;
219 
227  double scoreIsotopePattern_(const std::vector<double>& isotopes_int,
228  const IsotopeDistribution& isotope_dist) const;
229 
232  void getIsotopeIntysFromExpSpec_(double precursor_mz, SpectrumPtrType spectrum,
233  std::vector<double>& isotopes_int,
234  int charge_state) const;
235 
236  // Parameters
245 
247  };
248 }
249 
Representation of a peptide/protein sequence.
Definition: AASequence.h:112
Scoring of an spectrum at the peak apex of an chromatographic elution peak.
Definition: DIAScoring.h:85
TheoreticalSpectrumGenerator * generator
Definition: DIAScoring.h:246
double scoreIsotopePattern_(const std::vector< double > &isotopes_int, const IsotopeDistribution &isotope_dist) const
Compare an experimental isotope pattern to a theoretical one.
void getFirstIsotopeRelativeIntensities_(const std::vector< TransitionType > &transitions, OpenSwath::IMRMFeature *mrmfeature, std::map< std::string, double > &intensities) const
double dia_byseries_intensity_min_
Definition: DIAScoring.h:238
void score_with_isotopes(SpectrumPtrType spectrum, const std::vector< TransitionType > &transitions, double &dotprod, double &manhattan) const
Dotproduct / Manhattan score with theoretical spectrum.
bool dia_ms1_massdiff_score(double precursor_mz, SpectrumPtrType spectrum, double &ppm_score) const
void largePeaksBeforeFirstIsotope_(SpectrumPtrType spectrum, double mono_mz, double mono_int, int &nr_occurrences, double &max_ratio) const
Determine whether the current m/z value is a monoisotopic peak.
double scoreIsotopePattern_(const std::vector< double > &isotopes_int, double product_mz, int putative_fragment_charge) const
Compare an experimental isotope pattern to a theoretical one.
bool dia_extraction_ppm_
Definition: DIAScoring.h:243
DIAScoring(const DIAScoring &rhs)
Copy constructor (algorithm class)
OpenSwath::LightTransition TransitionType
Transition interface (Transition, Peptide, Protein)
Definition: DIAScoring.h:91
void dia_massdiff_score(const std::vector< TransitionType > &transitions, SpectrumPtrType spectrum, const std::vector< double > &normalized_library_intensity, double &ppm_score, double &ppm_score_weighted, std::vector< double > &diff_ppm) const
Massdiff scores, see class description.
OpenSwath::SpectrumPtr SpectrumPtrType
Type definitions.
Definition: DIAScoring.h:89
double dia_extract_window_
Definition: DIAScoring.h:237
void dia_by_ion_score(SpectrumPtrType spectrum, AASequence &sequence, int charge, double &bseries_score, double &yseries_score) const
b/y ion scores
double peak_before_mono_max_ppm_diff_
Definition: DIAScoring.h:242
void updateMembers_() override
Synchronize members with param class.
double dia_nr_charges_
Definition: DIAScoring.h:241
void dia_ms1_isotope_scores_averagine(double precursor_mz, SpectrumPtrType spectrum, double &isotope_corr, double &isotope_overlap, int charge_state) const
Precursor isotope scores for precursors (peptides and metabolites)
void getIsotopeIntysFromExpSpec_(double precursor_mz, SpectrumPtrType spectrum, std::vector< double > &isotopes_int, int charge_state) const
double scoreIsotopePattern_(const std::vector< double > &isotopes_int, const EmpiricalFormula &sum_formula) const
Compare an experimental isotope pattern to a theoretical one.
double dia_byseries_ppm_diff_
Definition: DIAScoring.h:239
void dia_ms1_isotope_scores(double precursor_mz, SpectrumPtrType spectrum, double &isotope_corr, double &isotope_overlap, const EmpiricalFormula &sum_formula) const
void diaIsotopeScoresSub_(const std::vector< TransitionType > &transitions, SpectrumPtrType spectrum, std::map< std::string, double > &intensities, double &isotope_corr, double &isotope_overlap) const
Subfunction of dia_isotope_scores.
~DIAScoring() override
Destructor.
double dia_nr_isotopes_
Definition: DIAScoring.h:240
DIAScoring & operator=(const DIAScoring &rhs)
Assignment operator (algorithm class)
bool dia_centroided_
Definition: DIAScoring.h:244
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
Representation of an empirical formula.
Definition: EmpiricalFormula.h:83
Definition: IsotopeDistribution.h:65
Generates theoretical spectra for peptides with various options.
Definition: TheoreticalSpectrumGenerator.h:70
Definition: ITransition.h:57
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:291
Definition: TransitionExperiment.h:46