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

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:40 using doxygen 1.8.5