OpenMS  2.8.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-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 $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #define USE_SP_INTERFACE
38 
39 // Actual scoring
41 
45 
46 // Kernel classes
55 
57 
58 #ifdef _OPENMP
59 #include <omp.h>
60 #endif
61 
62 bool SortDoubleDoublePairFirst(const std::pair<double, double>& left, const std::pair<double, double>& right);
63 
64 namespace OpenMS
65 {
66 
89  class OPENMS_DLLAPI MRMFeatureFinderScoring :
90  public DefaultParamHandler,
91  public ProgressLogger
92  {
93 
94 public:
96 
102  // a transition group holds the chromatographic data and peaks across
103  // multiple chromatograms from the same compound
105  typedef std::map<String, MRMTransitionGroupType> TransitionGroupMapType;
106 
108 
111 
114 
116 
117 
130  void pickExperiment(PeakMap & chromatograms, FeatureMap& output, TargetedExperiment& transition_exp,
131  TransformationDescription trafo, PeakMap& swath_map);
132 
148  FeatureMap& output,
149  OpenSwath::LightTargetedExperiment& transition_exp,
151  std::vector<OpenSwath::SwathMap> swath_maps,
152  TransitionGroupMapType& transition_group_map);
153 
163 
181  void scorePeakgroups(MRMTransitionGroupType& transition_group,
182  const TransformationDescription & trafo,
183  const std::vector<OpenSwath::SwathMap>& swath_maps,
184  FeatureMap& output,
185  bool ms1only = false) const;
186 
189  void setStrictFlag(bool f)
190  {
191  strict_ = f;
192  }
193 
204  {
205  ms1_map_ = ms1_map;
206  }
207 
224  OpenSwath::LightTargetedExperiment& transition_exp,
225  TransitionGroupMapType& transition_group_map,
227  double rt_extraction_window);
228 private:
229 
238  MRMTransitionGroupType& transition_group_detection) const;
239 
250  MRMTransitionGroupType& transition_group_identification,
251  MRMTransitionGroupType& transition_group_identification_decoy) const;
252 
270  OpenSwathScoring& scorer,
271  const size_t feature_idx,
272  const std::vector<std::string> & native_ids_detection,
273  const double det_intensity_ratio_score,
274  const double det_mi_ratio_score,
275  const std::vector<OpenSwath::SwathMap>& swath_maps) const;
276 
277  void prepareFeatureOutput_(OpenMS::MRMFeature& mrmfeature, bool ms1only, int charge) const;
278 
280  void updateMembers_() override;
281 
282  // parameters
287  bool strict_;
289 
290  // scoring parameters
297 
298  double sn_win_len_;
299  unsigned int sn_bin_count_;
301 
303 
304  // members
305  std::map<OpenMS::String, const PeptideType*> PeptideRefMap_;
310 
311  // data
313 
314  };
315 }
316 
317 #undef run_identifier
318 
bool SortDoubleDoublePairFirst(const std::pair< double, double > &left, const std::pair< double, double > &right)
Scoring of an spectrum at the peak apex of an chromatographic elution peak.
Definition: DIAScoring.h:84
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
Scoring of an elution peak using an exponentially modified gaussian distribution model.
Definition: EmgScoring.h:61
A container for features.
Definition: FeatureMap.h:106
The MRMFeatureFinder finds and scores peaks of transitions that co-elute.
Definition: MRMFeatureFinderScoring.h:92
MRMTransitionGroup< MSChromatogram, TransitionType > MRMTransitionGroupType
Definition: MRMFeatureFinderScoring.h:104
OpenSwath_Ind_Scores scoreIdentification_(MRMTransitionGroupType &transition_group_identification, OpenSwathScoring &scorer, const size_t feature_idx, const std::vector< std::string > &native_ids_detection, const double det_intensity_ratio_score, const double det_mi_ratio_score, const std::vector< OpenSwath::SwathMap > &swath_maps) const
Provides scoring for target and decoy identification against detecting transitions.
bool strict_
Definition: MRMFeatureFinderScoring.h:287
void mapExperimentToTransitionList(OpenSwath::SpectrumAccessPtr input, OpenSwath::LightTargetedExperiment &transition_exp, TransitionGroupMapType &transition_group_map, TransformationDescription trafo, double rt_extraction_window)
Map the chromatograms to the transitions.
OpenSwath::LightProtein ProteinType
Definition: MRMFeatureFinderScoring.h:100
int add_up_spectra_
Definition: MRMFeatureFinderScoring.h:292
double sn_win_len_
Definition: MRMFeatureFinderScoring.h:298
double spacing_for_spectra_resampling_
Definition: MRMFeatureFinderScoring.h:294
OpenMS::EmgScoring emgscoring_
Definition: MRMFeatureFinderScoring.h:309
int stop_report_after_feature_
Definition: MRMFeatureFinderScoring.h:285
OpenMS::SONARScoring sonarscoring_
Definition: MRMFeatureFinderScoring.h:308
OpenSwath::LightCompound PeptideType
Definition: MRMFeatureFinderScoring.h:99
OpenMS::DIAScoring diascoring_
Definition: MRMFeatureFinderScoring.h:307
void pickExperiment(OpenSwath::SpectrumAccessPtr input, FeatureMap &output, OpenSwath::LightTargetedExperiment &transition_exp, TransformationDescription trafo, std::vector< OpenSwath::SwathMap > swath_maps, TransitionGroupMapType &transition_group_map)
Pick features in one experiment containing chromatogram.
bool write_convex_hull_
Definition: MRMFeatureFinderScoring.h:286
void splitTransitionGroupsIdentification_(const MRMTransitionGroupType &transition_group, MRMTransitionGroupType &transition_group_identification, MRMTransitionGroupType &transition_group_identification_decoy) const
Splits combined transition groups into identification transition groups.
~MRMFeatureFinderScoring() override
Destructor.
std::map< OpenMS::String, const PeptideType * > PeptideRefMap_
Definition: MRMFeatureFinderScoring.h:305
OpenSwath::SpectrumAccessPtr ms1_map_
Definition: MRMFeatureFinderScoring.h:312
OpenSwath::LightTransition TransitionType
Type definitions.
Definition: MRMFeatureFinderScoring.h:97
void setMS1Map(OpenSwath::SpectrumAccessPtr ms1_map)
Add an MS1 map containing spectra.
Definition: MRMFeatureFinderScoring.h:203
double rt_normalization_factor_
Definition: MRMFeatureFinderScoring.h:291
OpenSwath_Scores_Usage su_
Definition: MRMFeatureFinderScoring.h:306
double uis_threshold_sn_
Definition: MRMFeatureFinderScoring.h:295
double quantification_cutoff_
Definition: MRMFeatureFinderScoring.h:284
void splitTransitionGroupsDetection_(const MRMTransitionGroupType &transition_group, MRMTransitionGroupType &transition_group_detection) const
Splits combined transition groups into detection transition groups.
void setStrictFlag(bool f)
Set the flag for strict mapping.
Definition: MRMFeatureFinderScoring.h:189
unsigned int sn_bin_count_
Definition: MRMFeatureFinderScoring.h:299
double uis_threshold_peak_area_
Definition: MRMFeatureFinderScoring.h:296
String spectrum_addition_method_
Definition: MRMFeatureFinderScoring.h:293
void scorePeakgroups(MRMTransitionGroupType &transition_group, const TransformationDescription &trafo, const std::vector< OpenSwath::SwathMap > &swath_maps, FeatureMap &output, bool ms1only=false) const
Score all peak groups of a transition group.
void prepareProteinPeptideMaps_(const OpenSwath::LightTargetedExperiment &transition_exp)
Prepares the internal mappings of peptides and proteins.
OpenSwath::LightTargetedExperiment TargetedExpType
Definition: MRMFeatureFinderScoring.h:98
bool write_log_messages_
Definition: MRMFeatureFinderScoring.h:300
void updateMembers_() override
Synchronize members with param class.
void pickExperiment(PeakMap &chromatograms, FeatureMap &output, TargetedExperiment &transition_exp, TransformationDescription trafo, PeakMap &swath_map)
Picker and prepare functions.
std::map< String, MRMTransitionGroupType > TransitionGroupMapType
Definition: MRMFeatureFinderScoring.h:105
double rt_extraction_window_
Definition: MRMFeatureFinderScoring.h:283
OpenSwath::LightModification ModificationType
Definition: MRMFeatureFinderScoring.h:101
void prepareFeatureOutput_(OpenMS::MRMFeature &mrmfeature, bool ms1only, int charge) const
double im_extra_drift_
Definition: MRMFeatureFinderScoring.h:302
String scoring_model_
Definition: MRMFeatureFinderScoring.h:288
A multi-chromatogram MRM feature.
Definition: MRMFeature.h:52
The representation of a group of transitions in a targeted proteomics experiment.
Definition: MRMTransitionGroup.h:68
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:73
A class that calls the scoring routines.
Definition: OpenSwathScoring.h:60
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:53
Scoring of an spectrum using SONAR data.
Definition: SONARScoring.h:56
A more convenient string class.
Definition: String.h:60
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:65
Generic description of a coordinate transformation.
Definition: TransformationDescription.h:63
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
A structure to store which scores should be used by the OpenSWATH Algorithm.
Definition: OpenSwathScores.h:51
boost::shared_ptr< ISpectrumAccess > SpectrumAccessPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:87
Definition: TransitionExperiment.h:142
Definition: TransitionExperiment.h:201
Definition: OpenSwathScores.h:195
Definition: TransitionExperiment.h:149
Definition: TransitionExperiment.h:207
Definition: TransitionExperiment.h:46