OpenMS  3.0.0
MRMScoring.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-2022.
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 $a
32 // $Authors: Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <string>
38 
40 #include <OpenMS/OPENSWATHALGO/OpenSwathAlgoConfig.h>
41 
47 
48 namespace OpenSwath
49 {
50 
72  class OPENMS_DLLAPI MRMScoring
73  {
74 
75  public:
77 
82 
87 
88  typedef boost::shared_ptr<OpenSwath::IFeature> FeatureType;
90 
93  const XCorrMatrixType& getXCorrMatrix() const;
96 
98  const XCorrMatrixType& getXCorrContrastMatrix() const;
100 
102  const XCorrMatrixType& getXCorrPrecursorContrastMatrix() const;
104 
106  const XCorrMatrixType& getXCorrPrecursorCombinedMatrix() const;
108 
111 
113  void initializeXCorrMatrix(const std::vector< std::vector< double > >& data);
114 
116  void initializeXCorrMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& native_ids);
117 
119  void initializeXCorrContrastMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& native_ids_set1, const std::vector<std::string>& native_ids_set2);
120 
122  void initializeXCorrPrecursorMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& precursor_ids);
123 
125  void initializeXCorrPrecursorContrastMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& precursor_ids, const std::vector<std::string>& native_ids);
126 
128  void initializeXCorrPrecursorContrastMatrix(const std::vector< std::vector< double > >& data_precursor, const std::vector< std::vector< double > >& data_fragments);
129 
131  void initializeXCorrPrecursorCombinedMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& precursor_ids, const std::vector<std::string>& native_ids);
132 
138  double calcXcorrCoelutionScore();
139 
147  double calcXcorrCoelutionWeightedScore(const std::vector<double>& normalized_library_intensity);
148 
150  double calcXcorrContrastCoelutionScore();
151 
153  std::vector<double> calcSeparateXcorrContrastCoelutionScore();
154 
156  double calcXcorrPrecursorCoelutionScore();
157 
163  double calcXcorrPrecursorContrastCoelutionScore();
164 
171  double calcXcorrPrecursorContrastSumFragCoelutionScore();
172 
174  double calcXcorrPrecursorCombinedCoelutionScore();
175 
182  double calcXcorrShapeScore();
183 
192  double calcXcorrShapeWeightedScore(const std::vector<double>& normalized_library_intensity);
193 
195  double calcXcorrContrastShapeScore();
196 
198  std::vector<double> calcSeparateXcorrContrastShapeScore();
199 
201  double calcXcorrPrecursorShapeScore();
202 
204  double calcXcorrPrecursorContrastShapeScore();
205 
212  double calcXcorrPrecursorContrastSumFragShapeScore();
213 
215  double calcXcorrPrecursorCombinedShapeScore();
216 
218  static void calcLibraryScore(OpenSwath::IMRMFeature* mrmfeature,
219  const std::vector<TransitionType>& transitions, double& correlation,
220  double& norm_manhattan, double& manhattan, double& dotprod,
221  double& spectral_angle, double& rmsd);
222 
224  static double calcRTScore(const PeptideType& peptide, double normalized_experimental_rt);
225 
227  // using a vector of SignalToNoiseEstimatorMedian that were calculated for
228  // each chromatogram of the transition_group.
229  static double calcSNScore(OpenSwath::IMRMFeature* mrmfeature,
230  std::vector<OpenSwath::ISignalToNoisePtr>& signal_noise_estimators);
231 
232  static std::vector<double> calcSeparateSNScore(OpenSwath::IMRMFeature* mrmfeature,
233  std::vector<OpenSwath::ISignalToNoisePtr>& signal_noise_estimators);
234 
236  const OpenMS::Matrix<double> & getMIMatrix() const;
238 
240  const OpenMS::Matrix<double> & getMIContrastMatrix() const;
242 
244  const OpenMS::Matrix<double> & getMIPrecursorContrastMatrix() const;
246 
248  const OpenMS::Matrix<double> & getMIPrecursorCombinedMatrix() const;
250 
252  void initializeMIMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& native_ids);
253 
255  void initializeMIContrastMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& native_ids_set1, const std::vector<std::string>& native_ids_set2);
256 
258  void initializeMIPrecursorMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& precursor_ids);
259 
261  void initializeMIPrecursorContrastMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& precursor_ids, const std::vector<std::string>& native_ids);
262 
264  void initializeMIPrecursorCombinedMatrix(OpenSwath::IMRMFeature* mrmfeature, const std::vector<std::string>& precursor_ids, const std::vector<std::string>& native_ids);
265 
266  double calcMIScore();
267  double calcMIWeightedScore(const std::vector<double>& normalized_library_intensity);
268  double calcMIPrecursorScore();
269  double calcMIPrecursorContrastScore();
270  double calcMIPrecursorCombinedScore();
271  std::vector<double> calcSeparateMIContrastScore();
272 
274 
275  private:
278  XCorrMatrixType xcorr_matrix_;
280 
284 
288 
291 
294 
298 
302 
304 
308 
311 
315 
319  };
320 }
OpenSwath::MRMScoring::xcorr_matrix_max_peak_
OpenMS::Matrix< int > xcorr_matrix_max_peak_
contains max Peaks from xcorr_matrix_
Definition: MRMScoring.h:282
OpenSwath::MRMScoring::xcorr_precursor_contrast_matrix_
XCorrMatrixType xcorr_precursor_contrast_matrix_
the precomputed cross correlation against the MS1 trace
Definition: MRMScoring.h:296
ITransition.h
OpenSwath::MRMScoring::xcorr_matrix_max_peak_sec_
OpenMS::Matrix< double > xcorr_matrix_max_peak_sec_
Definition: MRMScoring.h:283
OpenSwath
Definition: Scoring.h:43
TransitionExperiment.h
ISpectrumAccess.h
Matrix.h
StatsHelpers.h
OpenSwath::MRMScoring::mi_contrast_matrix_
OpenMS::Matrix< double > mi_contrast_matrix_
the precomputed contrast mutual information matrix
Definition: MRMScoring.h:307
OpenSwath::MRMScoring::mi_matrix_
OpenMS::Matrix< double > mi_matrix_
the precomputed mutual information matrix
Definition: MRMScoring.h:305
OpenSwath::MRMScoring::mi_precursor_combined_matrix_
OpenMS::Matrix< double > mi_precursor_combined_matrix_
the precomputed contrast mutual information matrix with the MS1 trace
Definition: MRMScoring.h:317
OpenSwath::MRMScoring::mi_precursor_contrast_matrix_
OpenMS::Matrix< double > mi_precursor_contrast_matrix_
the precomputed contrast mutual information matrix against the MS1 trace
Definition: MRMScoring.h:313
OpenSwath::MRMScoring
This class implements different scores for peaks found in SRM/MRM.
Definition: MRMScoring.h:72
OpenSwath::LightCompound
Definition: TransitionExperiment.h:160
OpenMS::Matrix< XCorrArrayType >
OpenSwath::MRMScoring::TransitionType
OpenSwath::LightTransition TransitionType
Definition: MRMScoring.h:84
OpenSwath::MRMScoring::xcorr_contrast_matrix_max_peak_sec_
OpenMS::Matrix< double > xcorr_contrast_matrix_max_peak_sec_
contains max Peaks from xcorr_contrast_matrix_
Definition: MRMScoring.h:290
OpenSwath::MRMScoring::xcorr_precursor_combined_matrix_
XCorrMatrixType xcorr_precursor_combined_matrix_
the precomputed cross correlation with the MS1 trace
Definition: MRMScoring.h:300
OpenSwath::MRMScoring::SpectrumType
OpenSwath::SpectrumPtr SpectrumType
Definition: MRMScoring.h:83
OpenSwath::MRMScoring::PeptideType
OpenSwath::LightCompound PeptideType
Definition: MRMScoring.h:85
OpenSwath::MRMScoring::ProteinType
OpenSwath::LightProtein ProteinType
Definition: MRMScoring.h:86
OpenSwath::MRMScoring::FeatureType
boost::shared_ptr< OpenSwath::IFeature > FeatureType
Definition: MRMScoring.h:88
OpenSwath::LightProtein
Definition: TransitionExperiment.h:212
OpenSwath::MRMScoring::xcorr_precursor_matrix_
XCorrMatrixType xcorr_precursor_matrix_
the precomputed cross correlation matrix of the MS1 trace
Definition: MRMScoring.h:293
OpenSwath::SpectrumPtr
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:296
OpenSwath::MRMScoring::mi_precursor_matrix_
OpenMS::Matrix< double > mi_precursor_matrix_
the precomputed mutual information matrix of the MS1 trace
Definition: MRMScoring.h:310
OpenSwath::Scoring::XCorrArrayType
Definition: Scoring.h:71
OpenSwath::MRMScoring::XCorrMatrixType
OpenMS::Matrix< XCorrArrayType > XCorrMatrixType
Cross Correlation matrix.
Definition: MRMScoring.h:81
OpenSwath::LightTransition
Definition: TransitionExperiment.h:45
OpenSwath::MRMScoring::xcorr_contrast_matrix_
XCorrMatrixType xcorr_contrast_matrix_
the precomputed contrast cross correlation
Definition: MRMScoring.h:286
OpenSwath::IMRMFeature
Definition: ITransition.h:56
Scoring.h