Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
OpenSwathScoring.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-2016.
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 $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_OPENSWATH_OPENSWATHSCORING_H
36 #define OPENMS_ANALYSIS_OPENSWATH_OPENSWATHSCORING_H
37 
38 // data access
43 
44 // scoring
46 
47 #include <boost/shared_ptr.hpp>
48 #include <boost/make_shared.hpp>
49 
50 namespace OpenMS
51 {
52 
57  struct OPENMS_DLLAPI OpenSwath_Scores_Usage
58  {
59  // Which scores to use
70 
72  use_coelution_score_(true),
73  use_shape_score_(true),
74  use_rt_score_(true),
75  use_library_score_(true),
76  use_elution_model_score_(true),
77  use_intensity_score_(true),
78  use_total_xic_score_(true),
79  use_nr_peaks_score_(true),
80  use_sn_score_(true),
81  use_dia_scores_(true)
82  {}
83 
87  };
88 
97  struct OPENMS_DLLAPI OpenSwath_Scores
98  {
100  double library_corr;
108  std::string ind_isotope_overlap;
110  std::string ind_massdev_score;
117  double log_sn_score;
118  std::string ind_log_sn_score;
120  std::string ind_transition_names;
121  std::string ind_log_intensity;
122 
126 
132 
135  double intensity;
136  double total_xic;
137  double nr_peaks;
138  double sn_ratio;
139 
142  double raw_rt_score;
143 
146 
148  elution_model_fit_score(0),
149  library_corr(0),
150  library_norm_manhattan(0),
151  library_rootmeansquare(0),
152  library_sangle(0),
153  norm_rt_score(0),
154  isotope_correlation(0),
155  ind_isotope_correlation(""),
156  isotope_overlap(0),
157  ind_isotope_overlap(""),
158  massdev_score(0),
159  ind_massdev_score(""),
160  xcorr_coelution_score(0),
161  ind_xcorr_coelution_score(""),
162  xcorr_shape_score(0),
163  ind_xcorr_shape_score(""),
164  yseries_score(0),
165  bseries_score(0),
166  log_sn_score(0),
167  ind_log_sn_score(""),
168  ind_num_transitions(0),
169  ind_transition_names(""),
170  ind_log_intensity(""),
171  weighted_coelution_score(0),
172  weighted_xcorr_shape(0),
173  weighted_massdev_score(0),
174  xcorr_ms1_coelution_score(0),
175  xcorr_ms1_shape_score(0),
176  ms1_ppm_score(0),
177  ms1_isotope_correlation(0),
178  ms1_isotope_overlap(0),
179  library_manhattan(0),
180  library_dotprod(0),
181  intensity(0),
182  total_xic(0),
183  nr_peaks(0),
184  sn_ratio(0),
185  dotprod_score_dia(0),
186  manhatt_score_dia(0)
187  {
188  }
189 
190 
191  double get_quick_lda_score(double library_corr_, double library_norm_manhattan_, double norm_rt_score_, double xcorr_coelution_score_,
192  double xcorr_shape_score_, double log_sn_score_)
193  {
194  // some scores based on manual evaluation of 80 chromatograms
195  // quick LDA average model on 100 2 x Crossvalidated runs (0.85 TPR/0.17 FDR)
196  // true: mean 4.2 with sd 1.055
197  // false: mean -0.07506772 with sd 1.055
198  // below -0.5 removes around 30% of the peaks
199  // below 0 removes around 50% of the peaks
200  // below 0.5 removes around 70% of the peaks
201  // below 1.0 removes around 85% of the peaks
202  // below 1.5 removes around 93% of the peaks
203  // below 2.0 removes around 97% of the peaks
204  //
205  // NOTE this score means "better" if it is more negative!
206  double lda_quick_score =
207  library_corr_ * -0.5319046 +
208  library_norm_manhattan_ * 2.1643962 +
209  norm_rt_score_ * 8.0353047 +
210  xcorr_coelution_score_ * 0.1458914 +
211  xcorr_shape_score_ * -1.6901925 +
212  log_sn_score_ * -0.8002824;
213  return lda_quick_score;
214  }
215 
217  {
218 
219  // LDA average model on 100 2 x Crossvalidated runs (0.91 TPR/0.20 FDR)
220  /*
221  double xx_old_lda_prescore =
222  intensity_score * -2.296679 +
223  library_corr * -0.1223876 +
224  library_norm_manhattan* 2.013638 +
225  nr_peaks_score * 0.01683357 +
226  rt_score * 0.00143999 +
227  sn_score * -0.1619762 +
228  total_xic_score * 0.00000003697898 +
229  xcorr_coelution_score * 0.05909583 +
230  xcorr_shape_score * -0.4699841;
231 
232  // NOTE this score means "better" if it is more negative!
233  */
234 
235  return scores.library_corr * -0.34664267 +
236  scores.library_norm_manhattan * 2.98700722 +
237  scores.norm_rt_score * 7.05496384 +
238  scores.xcorr_coelution_score * 0.09445371 +
239  scores.xcorr_shape_score * -5.71823862 +
240  scores.log_sn_score * -0.72989582 +
241  scores.elution_model_fit_score * 1.88443209;
242  }
243 
245  {
246 
247  // Swath - LDA average model on 100 2 x Crossvalidated runs (0.76 TPR/0.20 FDR) [without elution model]
248  /*
249  double xx_old_swath_prescore =
250  intensity_score * -3.148838e+00 +
251  library_corr * -7.562403e-02 +
252  library_norm_manhattan * 1.786286e+00 +
253  nr_peaks_score * -7.674263e-03 +
254  rt_score * 1.748377e-03 +
255  sn_score * -1.372636e-01 +
256  total_xic_score * 7.278437e-08 +
257  xcorr_coelution_score * 1.181813e-01 +
258  weighted_coelution_score * -7.661783e-02 +
259  xcorr_shape_score * -6.903933e-02 +
260  weighted_xcorr_shape * -4.234820e-01 +
261  bseries_score * -2.022380e-02 +
262  massdev_score * 2.844948e-02 +
263  massdev_score_weighted * 1.133209e-02 +
264  yseries_score * -9.510874e-02 +
265  isotope_corr * -1.619902e+00 +
266  isotope_overlap * 2.890688e-01 ;
267 
268  // NOTE this score means "better" if it is more negative!
269  */
270 
271  return scores.library_corr * -0.19011762 +
272  scores.library_norm_manhattan * 2.47298914 +
273  scores.norm_rt_score * 5.63906731 +
274  scores.isotope_correlation * -0.62640133 +
275  scores.isotope_overlap * 0.36006925 +
276  scores.massdev_score * 0.08814003 +
277  scores.xcorr_coelution_score * 0.13978311 +
278  scores.xcorr_shape_score * -1.16475032 +
279  scores.yseries_score * -0.19267813 +
280  scores.log_sn_score * -0.61712054;
281 
282 /*
283 
284 
285 Gold standard, best sample
286  main_var_xx_swath_prelim_score 0.291440015642621
287  var_bseries_score 0.0496492555026149
288  var_dotprod_score -0.522561744728316
289  var_elution_model_fit_score -1.99429446109581
290  var_intensity_score 1.70915451039584
291  var_isotope_correlation_score 0.966260829910062
292  var_isotope_overlap_score -14.216079147368
293  var_library_corr 0.061432632721274
294  var_library_dotprod -3.79958938222036
295  var_library_manhattan -1.36520528433508
296  var_library_norm_manhattan -6.44998534845163
297  var_log_sn_score -0.0389995774588385
298  var_manhatt_score -0.0944805864772705
299  var_massdev_score 0.0144460056621709
300  var_massdev_score_weighted -0.0494772144218002
301  var_norm_rt_score -9.04596725429934
302  var_xcorr_coelution -0.141763244951207
303  var_xcorr_coelution_weighted 0.00261409408565438
304  var_xcorr_shape 4.89741810577371
305  var_xcorr_shape_weighted 0.342723332762697
306  var_yseries_score -0.188316503432445
307 
308 
309 Strep Strep0_Repl2_R02/runlogs_mprophet.tar.gz
310 main_var_xx_swath_prelim_score 0.231523019269729
311 var_bseries_score -0.0488528503276347
312 var_elution_model_fit_score -0.47977060647858
313 var_intensity_score -0.80664074459128
314 var_isotope_correlation_score 2.34488326031997
315 var_isotope_overlap_score -2.14735763746488
316 var_library_corr -0.395167010986141
317 var_library_norm_manhattan -13.1295053007338
318 var_log_sn_score 0.265784828465348
319 var_massdev_score 0.0150193500103614
320 var_massdev_score_weighted -0.109859906028132
321 var_norm_rt_score -25.7107556062008
322 var_xcorr_coelution 0.244590396074410
323 var_xcorr_coelution_weighted -0.918578472543494
324 var_xcorr_shape 2.18720521365230
325 var_xcorr_shape_weighted -0.815295893352108
326 var_yseries_score -0.0620070175846356
327 
328 Strep10_Repl2_R02/runlogs_mprophet.tar.gz
329 main_var_xx_swath_prelim_score 0.293470108599468
330 var_bseries_score -0.0129641361717189
331 var_elution_model_fit_score -0.44993587229358
332 var_intensity_score -0.828540564651968
333 var_isotope_correlation_score 2.76284687671386
334 var_isotope_overlap_score -2.26460097307479
335 var_library_corr -0.445369627383142
336 var_library_norm_manhattan -13.2905041886848
337 var_log_sn_score 0.224626177093898
338 var_massdev_score 0.0185003919755981
339 var_massdev_score_weighted -0.0899477179756381
340 var_norm_rt_score -24.4807649346717
341 var_xcorr_coelution 0.218195211767293
342 var_xcorr_coelution_weighted -0.91949559943762
343 var_xcorr_shape 1.77358514815991
344 var_xcorr_shape_weighted -0.616535104461374
345 var_yseries_score -0.0652111196389966
346 
347 
348 
349 
350 // FINAL AQUA gold standard classifier
351 human
352 main_var_xx_swath_prelim_score 0.4384384475524
353 var_bseries_score 0.00227405501436837
354 var_elution_model_fit_score -2.06412570248571
355 var_intensity_score -1.26021147555789
356 var_isotope_correlation_score 1.21887083303546
357 var_isotope_overlap_score -1.60051046353231
358 var_library_corr -0.33958843974352
359 var_library_norm_manhattan -5.20235596662978
360 var_log_sn_score 0.24021015633787
361 var_massdev_score 0.0399855393620327
362 var_massdev_score_weighted -0.0907785715261295
363 var_norm_rt_score -16.2155920223681
364 var_xcorr_coelution 0.0805852135076143
365 var_xcorr_coelution_weighted -0.387927719728573
366 var_xcorr_shape 1.885899937033
367 var_xcorr_shape_weighted 2.45579580649067
368 var_yseries_score 0.138306574987678
369 
370 yeast
371 main_var_xx_swath_prelim_score 0.369009421609329
372 var_bseries_score 0.0157508674154482
373 var_elution_model_fit_score -1.67348268698707
374 var_intensity_score -1.11972743418717
375 var_isotope_correlation_score 1.68717154416093
376 var_isotope_overlap_score -1.38410070381813
377 var_library_corr -0.454409692201745
378 var_library_norm_manhattan -6.08160902837145
379 var_log_sn_score 0.157259477914274
380 var_massdev_score 0.0543919580711367
381 var_massdev_score_weighted -0.137296627160332
382 var_norm_rt_score -28.4381743938298
383 var_xcorr_coelution 0.0256469469673884
384 var_xcorr_coelution_weighted -0.362865323100099
385 var_xcorr_shape 1.88863198062243
386 var_xcorr_shape_weighted 1.3518953353109
387 var_yseries_score 0.115472572686466
388 
389 water
390 main_var_xx_swath_prelim_score 0.174880281226536
391 var_bseries_score -0.0606466737704899
392 var_elution_model_fit_score -0.123252502705892
393 var_intensity_score 1.91714146537607
394 var_isotope_correlation_score 0.914387652486204
395 var_isotope_overlap_score -1.46521560409083
396 var_library_corr -0.485498555013885
397 var_library_norm_manhattan -8.3847526088391
398 var_log_sn_score 0.00644514889704832
399 var_massdev_score 0.0177435175558717
400 var_massdev_score_weighted -0.0899451169038299
401 var_norm_rt_score -15.1458716759687
402 var_xcorr_coelution -0.370050235089866
403 var_xcorr_coelution_weighted 0.21512520647974
404 var_xcorr_shape 0.563413547839886
405 var_xcorr_shape_weighted -0.270773625703933
406 var_yseries_score -0.0327896378737766
407 
408 
409 
410 */
411  }
412 
413  };
414 
420  class OPENMS_DLLAPI OpenSwathScoring
421  {
424 
429 
430  public:
431 
434 
436  ~OpenSwathScoring();
437 
448  void initialize(double rt_normalization_factor,
449  int add_up_spectra, double spacing_for_spectra_resampling,
451 
469  void calculateChromatographicScores(
470  OpenSwath::IMRMFeature* imrmfeature,
471  const std::vector<std::string>& native_ids,
472  const std::vector<double>& normalized_library_intensity,
473  std::vector<OpenSwath::ISignalToNoisePtr>& signal_noise_estimators,
474  OpenSwath_Scores & scores);
475 
494  void calculateChromatographicIdScores(
495  OpenSwath::IMRMFeature* imrmfeature,
496  const std::vector<std::string>& native_ids_identification,
497  const std::vector<std::string>& native_ids_detection,
498  std::vector<OpenSwath::ISignalToNoisePtr>& signal_noise_estimators,
499  OpenSwath_Scores & scores);
500 
516  void calculateLibraryScores(
517  OpenSwath::IMRMFeature* imrmfeature,
518  const std::vector<TransitionType> & transitions,
519  const PeptideType& pep,
520  const double normalized_feature_rt,
521  OpenSwath_Scores & scores);
522 
536  void calculateDIAScores(OpenSwath::IMRMFeature* imrmfeature,
537  const std::vector<TransitionType> & transitions,
540  OpenMS::DIAScoring & diascoring,
541  const PeptideType& pep,
542  OpenSwath_Scores & scores);
543 
555  void calculateDIAIdScores(OpenSwath::IMRMFeature* imrmfeature,
556  const TransitionType & transition,
558  OpenMS::DIAScoring & diascoring,
559  OpenSwath_Scores & scores);
560 
569  void getNormalized_library_intensities_(const std::vector<TransitionType> & transitions,
570  std::vector<double>& normalized_library_intensity);
571 
583  OpenSwath::SpectrumPtr getAddedSpectra_(OpenSwath::SpectrumAccessPtr swath_map,
584  double RT, int nr_spectra_to_add);
585 
586  };
587 }
588 
589 #endif
double dotprod_score_dia
Definition: OpenSwathScoring.h:144
double isotope_overlap
Definition: OpenSwathScoring.h:107
double xcorr_ms1_coelution_score
Definition: OpenSwathScoring.h:127
double isotope_correlation
Definition: OpenSwathScoring.h:105
OpenSwath::LightPeptide PeptideType
Definition: OpenSwathScoring.h:422
bool use_dia_scores_
Definition: OpenSwathScoring.h:69
bool use_nr_peaks_score_
Definition: OpenSwathScoring.h:67
bool use_uis_scores
Definition: OpenSwathScoring.h:86
std::string ind_log_sn_score
Definition: OpenSwathScoring.h:118
double weighted_coelution_score
Definition: OpenSwathScoring.h:123
boost::shared_ptr< ISpectrumAccess > SpectrumAccessPtr
Definition: openswathalgo/include/OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:90
double rt_normalization_factor_
Definition: OpenSwathScoring.h:425
double spacing_for_spectra_resampling_
Definition: OpenSwathScoring.h:427
bool use_elution_model_score_
Definition: OpenSwathScoring.h:64
A class that calls the scoring routines.
Definition: OpenSwathScoring.h:420
double get_quick_lda_score(double library_corr_, double library_norm_manhattan_, double norm_rt_score_, double xcorr_coelution_score_, double xcorr_shape_score_, double log_sn_score_)
Definition: OpenSwathScoring.h:191
OpenSwath_Scores_Usage()
Definition: OpenSwathScoring.h:71
double sn_ratio
Definition: OpenSwathScoring.h:138
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/DATAACCESS/DataStructures.h:242
double weighted_xcorr_shape
Definition: OpenSwathScoring.h:124
bool use_ms1_fullscan
Definition: OpenSwathScoring.h:85
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
int add_up_spectra_
Definition: OpenSwathScoring.h:426
std::string ind_log_intensity
Definition: OpenSwathScoring.h:121
double total_xic
Definition: OpenSwathScoring.h:136
double xcorr_ms1_shape_score
Definition: OpenSwathScoring.h:128
bool use_library_score_
Definition: OpenSwathScoring.h:63
double raw_rt_score
Definition: OpenSwathScoring.h:142
OpenSwath_Scores()
Definition: OpenSwathScoring.h:147
double library_manhattan
Definition: OpenSwathScoring.h:133
double library_sangle
Definition: OpenSwathScoring.h:103
Definition: TransitionExperiment.h:133
double normalized_experimental_rt
Definition: OpenSwathScoring.h:141
std::string ind_isotope_correlation
Definition: OpenSwathScoring.h:106
double ms1_isotope_correlation
Definition: OpenSwathScoring.h:130
double ms1_ppm_score
Definition: OpenSwathScoring.h:129
std::string ind_xcorr_coelution_score
Definition: OpenSwathScoring.h:112
bool use_sn_score_
Definition: OpenSwathScoring.h:68
double log_sn_score
Definition: OpenSwathScoring.h:117
Scoring of an spectrum at the peak apex of an chromatographic elution peak.
Definition: DIAScoring.h:82
double massdev_score
Definition: OpenSwathScoring.h:109
double yseries_score
Definition: OpenSwathScoring.h:115
std::string ind_massdev_score
Definition: OpenSwathScoring.h:110
double manhatt_score_dia
Definition: OpenSwathScoring.h:145
double ms1_isotope_overlap
Definition: OpenSwathScoring.h:131
double xcorr_coelution_score
Definition: OpenSwathScoring.h:111
Definition: TransitionExperiment.h:47
std::string ind_xcorr_shape_score
Definition: OpenSwathScoring.h:114
A structure to store which scores should be used by the Algorithm.
Definition: OpenSwathScoring.h:57
Definition: ITransition.h:56
std::string ind_isotope_overlap
Definition: OpenSwathScoring.h:108
OpenSwath::LightTransition TransitionType
Definition: OpenSwathScoring.h:423
A structure to hold the different scores computed by OpenSWATH.
Definition: OpenSwathScoring.h:97
double library_norm_manhattan
Definition: OpenSwathScoring.h:101
OpenSwath_Scores_Usage su_
Definition: OpenSwathScoring.h:428
double xcorr_shape_score
Definition: OpenSwathScoring.h:113
double calculate_swath_lda_prescore(OpenSwath_Scores scores)
Definition: OpenSwathScoring.h:244
bool use_ms1_correlation
Definition: OpenSwathScoring.h:84
double norm_rt_score
Definition: OpenSwathScoring.h:104
double rt_difference
Definition: OpenSwathScoring.h:140
std::string ind_transition_names
Definition: OpenSwathScoring.h:120
double library_rootmeansquare
Definition: OpenSwathScoring.h:102
double elution_model_fit_score
Definition: OpenSwathScoring.h:99
double weighted_massdev_score
Definition: OpenSwathScoring.h:125
double intensity
Definition: OpenSwathScoring.h:135
int ind_num_transitions
Definition: OpenSwathScoring.h:119
bool use_rt_score_
Definition: OpenSwathScoring.h:62
double bseries_score
Definition: OpenSwathScoring.h:116
double library_dotprod
Definition: OpenSwathScoring.h:134
double library_corr
Definition: OpenSwathScoring.h:100
double nr_peaks
Definition: OpenSwathScoring.h:137
bool use_intensity_score_
Definition: OpenSwathScoring.h:65
bool use_coelution_score_
Definition: OpenSwathScoring.h:60
bool use_total_xic_score_
Definition: OpenSwathScoring.h:66
double calculate_lda_prescore(OpenSwath_Scores scores)
Definition: OpenSwathScoring.h:216
bool use_shape_score_
Definition: OpenSwathScoring.h:61

OpenMS / TOPP release 2.0.0 Documentation generated on Tue Jan 31 2017 06:39:51 using doxygen 1.8.8