OpenMS  2.5.0
MRMFeatureFinderScoring.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-2020.
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 #pragma once
36 
37 #define USE_SP_INTERFACE
38 
39 // Actual scoring
41 
45 
46 // Kernel classes
55 
57 
58 #include <boost/shared_ptr.hpp>
59 #include <boost/make_shared.hpp>
60 #include <boost/unordered_map.hpp>
61 
62 #ifdef _OPENMP
63 #include <omp.h>
64 #endif
65 
66 bool SortDoubleDoublePairFirst(const std::pair<double, double>& left, const std::pair<double, double>& right);
67 
68 namespace OpenMS
69 {
70 
93  class OPENMS_DLLAPI MRMFeatureFinderScoring :
94  public DefaultParamHandler,
95  public ProgressLogger
96  {
97 
98 public:
100 
106  // a transition group holds the chromatographic data and peaks across
107  // multiple chromatograms from the same compound
109  typedef std::map<String, MRMTransitionGroupType> TransitionGroupMapType;
110 
112 
115 
117  ~MRMFeatureFinderScoring() override;
118 
120 
121 
134  void pickExperiment(PeakMap & chromatograms, FeatureMap& output, TargetedExperiment& transition_exp,
135  TransformationDescription trafo, PeakMap& swath_map);
136 
151  void pickExperiment(OpenSwath::SpectrumAccessPtr input,
152  FeatureMap& output,
153  OpenSwath::LightTargetedExperiment& transition_exp,
155  std::vector<OpenSwath::SwathMap> swath_maps,
156  TransitionGroupMapType& transition_group_map);
157 
165  void prepareProteinPeptideMaps_(const OpenSwath::LightTargetedExperiment& transition_exp);
167 
185  void scorePeakgroups(MRMTransitionGroupType& transition_group,
186  const TransformationDescription & trafo,
187  const std::vector<OpenSwath::SwathMap>& swath_maps,
188  FeatureMap& output,
189  bool ms1only = false);
190 
193  void setStrictFlag(bool f)
194  {
195  strict_ = f;
196  }
197 
208  {
209  ms1_map_ = ms1_map;
210  }
211 
227  void mapExperimentToTransitionList(OpenSwath::SpectrumAccessPtr input,
228  OpenSwath::LightTargetedExperiment& transition_exp,
229  TransitionGroupMapType& transition_group_map,
231  double rt_extraction_window);
232 private:
233 
241  void splitTransitionGroupsDetection_(const MRMTransitionGroupType& transition_group,
242  MRMTransitionGroupType& transition_group_detection);
243 
253  void splitTransitionGroupsIdentification_(const MRMTransitionGroupType& transition_group,
254  MRMTransitionGroupType& transition_group_identification,
255  MRMTransitionGroupType& transition_group_identification_decoy);
256 
274  OpenSwath_Ind_Scores scoreIdentification_(MRMTransitionGroupType& transition_group_identification,
275  OpenSwathScoring& scorer,
276  const size_t feature_idx,
277  const std::vector<std::string> & native_ids_detection,
278  const double det_intensity_ratio_score,
279  const double det_mi_ratio_score,
280  const std::vector<OpenSwath::SwathMap>& swath_maps);
281 
282  void prepareFeatureOutput_(OpenMS::MRMFeature& mrmfeature, bool ms1only, int charge);
283 
285  void updateMembers_() override;
286 
287  // parameters
292  bool strict_;
294 
295  // scoring parameters
302 
303  double sn_win_len_;
304  unsigned int sn_bin_count_;
306 
308 
309  // members
310  std::map<OpenMS::String, const PeptideType*> PeptideRefMap_;
315 
316  // data
318 
319  };
320 }
321 
322 #undef run_identifier
323 
OpenMS::MRMFeatureFinderScoring::ms1_map_
OpenSwath::SpectrumAccessPtr ms1_map_
Definition: MRMFeatureFinderScoring.h:317
TargetedExperiment.h
OpenMS::MRMFeatureFinderScoring::quantification_cutoff_
double quantification_cutoff_
Definition: MRMFeatureFinderScoring.h:289
OpenMS::MRMFeatureFinderScoring::uis_threshold_peak_area_
double uis_threshold_peak_area_
Definition: MRMFeatureFinderScoring.h:301
OpenSwathScoring.h
OpenMS::MRMFeatureFinderScoring::su_
OpenSwath_Scores_Usage su_
Definition: MRMFeatureFinderScoring.h:311
DIAScoring.h
OpenMS::MRMFeatureFinderScoring::PeptideRefMap_
std::map< OpenMS::String, const PeptideType * > PeptideRefMap_
Definition: MRMFeatureFinderScoring.h:310
OpenMS::MRMFeatureFinderScoring::scoring_model_
String scoring_model_
Definition: MRMFeatureFinderScoring.h:293
OpenMS::MRMFeatureFinderScoring::strict_
bool strict_
Definition: MRMFeatureFinderScoring.h:292
OpenMS::DIAScoring
Scoring of an spectrum at the peak apex of an chromatographic elution peak.
Definition: DIAScoring.h:83
SwathMap.h
OpenMS::MRMFeatureFinderScoring::im_extra_drift_
double im_extra_drift_
Definition: MRMFeatureFinderScoring.h:307
OpenMS::MRMFeatureFinderScoring::sn_bin_count_
unsigned int sn_bin_count_
Definition: MRMFeatureFinderScoring.h:304
OpenMS::MRMFeatureFinderScoring
The MRMFeatureFinder finds and scores peaks of transitions that co-elute.
Definition: MRMFeatureFinderScoring.h:93
SortDoubleDoublePairFirst
bool SortDoubleDoublePairFirst(const std::pair< double, double > &left, const std::pair< double, double > &right)
OpenMS::MRMFeatureFinderScoring::MRMTransitionGroupType
MRMTransitionGroup< MSChromatogram, TransitionType > MRMTransitionGroupType
Definition: MRMFeatureFinderScoring.h:108
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::MRMFeatureFinderScoring::emgscoring_
OpenMS::EmgScoring emgscoring_
Definition: MRMFeatureFinderScoring.h:314
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::MRMFeatureFinderScoring::sn_win_len_
double sn_win_len_
Definition: MRMFeatureFinderScoring.h:303
OpenSwath::LightModification
Definition: TransitionExperiment.h:142
OpenMS::OpenSwath_Ind_Scores
Definition: OpenSwathScores.h:192
TransformationDescription.h
OpenMS::MRMFeatureFinderScoring::PeptideType
OpenSwath::LightCompound PeptideType
Definition: MRMFeatureFinderScoring.h:103
OpenSwath::LightTargetedExperiment
Definition: TransitionExperiment.h:207
OpenMS::MRMFeatureFinderScoring::uis_threshold_sn_
double uis_threshold_sn_
Definition: MRMFeatureFinderScoring.h:300
OpenMS::MRMFeatureFinderScoring::ModificationType
OpenSwath::LightModification ModificationType
Definition: MRMFeatureFinderScoring.h:105
OpenMS::MRMFeature
A multi-chromatogram MRM feature.
Definition: MRMFeature.h:50
OpenMS::MRMFeatureFinderScoring::TransitionGroupMapType
std::map< String, MRMTransitionGroupType > TransitionGroupMapType
Definition: MRMFeatureFinderScoring.h:109
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
MRMTransitionGroup.h
OpenMS::MRMFeatureFinderScoring::write_log_messages_
bool write_log_messages_
Definition: MRMFeatureFinderScoring.h:305
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenSwath::LightCompound
Definition: TransitionExperiment.h:149
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
MRMFeature.h
FeatureMap.h
OpenMS::MRMFeatureFinderScoring::setStrictFlag
void setStrictFlag(bool f)
Set the flag for strict mapping.
Definition: MRMFeatureFinderScoring.h:193
OpenMS::MRMFeatureFinderScoring::spacing_for_spectra_resampling_
double spacing_for_spectra_resampling_
Definition: MRMFeatureFinderScoring.h:299
OpenMS::MRMFeatureFinderScoring::ProteinType
OpenSwath::LightProtein ProteinType
Definition: MRMFeatureFinderScoring.h:104
OpenMS::OpenSwathScoring
A class that calls the scoring routines.
Definition: OpenSwathScoring.h:59
SONARScoring.h
EmgScoring.h
OpenMS::MRMFeatureFinderScoring::setMS1Map
void setMS1Map(OpenSwath::SpectrumAccessPtr ms1_map)
Add an MS1 map containing spectra.
Definition: MRMFeatureFinderScoring.h:207
OpenMS::MRMFeatureFinderScoring::sonarscoring_
OpenMS::SONARScoring sonarscoring_
Definition: MRMFeatureFinderScoring.h:313
OpenMS::EmgScoring
Scoring of an elution peak using an exponentially modified gaussian distribution model.
Definition: EmgScoring.h:59
OpenMS::MRMFeatureFinderScoring::spectrum_addition_method_
String spectrum_addition_method_
Definition: MRMFeatureFinderScoring.h:298
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:95
OpenMS::MRMFeatureFinderScoring::add_up_spectra_
int add_up_spectra_
Definition: MRMFeatureFinderScoring.h:297
OpenMS::MRMFeatureFinderScoring::write_convex_hull_
bool write_convex_hull_
Definition: MRMFeatureFinderScoring.h:291
OpenMS::MRMFeatureFinderScoring::rt_normalization_factor_
double rt_normalization_factor_
Definition: MRMFeatureFinderScoring.h:296
OpenMS::MRMFeatureFinderScoring::rt_extraction_window_
double rt_extraction_window_
Definition: MRMFeatureFinderScoring.h:288
MSChromatogram.h
OpenSwath::LightProtein
Definition: TransitionExperiment.h:201
OpenSwath::SpectrumAccessPtr
boost::shared_ptr< ISpectrumAccess > SpectrumAccessPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:89
OpenMS::MRMTransitionGroup
The representation of a group of transitions in a targeted proteomics experiment.
Definition: MRMTransitionGroup.h:67
OpenMS::SONARScoring
Scoring of an spectrum using SONAR data.
Definition: SONARScoring.h:54
OpenMS::MRMFeatureFinderScoring::TargetedExpType
OpenSwath::LightTargetedExperiment TargetedExpType
Definition: MRMFeatureFinderScoring.h:102
OpenMS::MRMFeatureFinderScoring::diascoring_
OpenMS::DIAScoring diascoring_
Definition: MRMFeatureFinderScoring.h:312
OpenMS::TargetedExperiment
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:64
OpenMS::MRMFeatureFinderScoring::TransitionType
OpenSwath::LightTransition TransitionType
Type definitions.
Definition: MRMFeatureFinderScoring.h:101
OpenMS::MRMFeatureFinderScoring::stop_report_after_feature_
int stop_report_after_feature_
Definition: MRMFeatureFinderScoring.h:290
OpenSwath::LightTransition
Definition: TransitionExperiment.h:46
OpenMS::TransformationDescription
Generic description of a coordinate transformation.
Definition: TransformationDescription.h:61
StandardTypes.h
OpenMS::OpenSwath_Scores_Usage
A structure to store which scores should be used by the OpenSWATH Algorithm.
Definition: OpenSwathScores.h:50
MSSpectrum.h