OpenMS
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IonMobilityScoring.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Hannes Roest $
6 // $Authors: Hannes Roest $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // data access
19 
20 // Kernel classes
23 
24 // scoring
26 
28 #include <vector>
29 namespace OpenMS
30 {
31 
32  struct RangeMobility;
33  struct RangeMZ;
34 
46  class OPENMS_DLLAPI IonMobilityScoring
47  {
51 
52  public:
53 
56 
59 
77  static void driftScoring(const SpectrumSequence& spectra,
78  const std::vector<TransitionType> & transitions,
79  OpenSwath_Scores & scores,
80  const double drift_target,
81  RangeMobility im_range,
82  const double dia_extraction_window_,
83  const bool dia_extraction_ppm_,
84  const double drift_extra,
85  const bool apply_im_peak_picking);
86 
101  static void driftScoringMS1(const SpectrumSequence& spectra,
102  const std::vector<TransitionType> & transitions,
103  OpenSwath_Scores & scores,
104  const double drift_target,
105  RangeMobility im_range,
106  const double dia_extraction_window_,
107  const bool dia_extraction_ppm_,
108  const double drift_extra);
109 
124  static void driftScoringMS1Contrast(const SpectrumSequence& spectra, const SpectrumSequence& ms1spectrum,
125  const std::vector<TransitionType> & transitions,
126  OpenSwath_Scores & scores,
127  RangeMobility im_range,
128  const double dia_extraction_window_,
129  const bool dia_extraction_ppm_,
130  const double drift_extra);
131 
146  static void driftIdScoring(const SpectrumSequence& spectra,
147  const std::vector<TransitionType> & transitions,
148  MRMTransitionGroupType& transition_group_detection,
149  OpenSwath_Scores & scores,
150  const double drift_target,
151  RangeMobility im_range,
152  const double dia_extract_window_,
153  const bool dia_extraction_ppm_,
154  const double drift_extra,
155  const bool apply_im_peak_picking);
156 
169  static void computeIonMobilogram(const SpectrumSequence& spectra,
170  const RangeMZ & mz_range,
171  const RangeMobility & im_range,
172  double & im,
173  double & intensity,
174  Mobilogram & res,
175  double eps);
176 
177 
178  private:
182  static std::vector<double> computeGrid_(const std::vector< Mobilogram >& mobilograms, double eps);
183 
184 
185  /*
186  @brief Extracts ion mobility values projected onto a grid
187 
188  For a given ion mobility profile and a grid, compute an ion mobilogram
189  across the grid for each ion mobility data point. Returns two data arrays
190  for the ion mobilogram: intensity (y) and ion mobility (x). Zero values are
191  inserted if no data point was found for a given grid value.
192 
193  @param profile The ion mobility data
194  @param im_grid The grid to be used
195  @param eps Epsilon used for computing the ion mobility grid
196  @param max_peak_idx The grid position of the maximum
197  */
198  static void alignToGrid_(const Mobilogram& profile,
199  const std::vector<double>& im_grid,
200  Mobilogram & aligned_profile,
201  double eps,
202  Size & max_peak_idx);
203 
204  /*
205  @brief Extracts intensity values from a vector of Mobilogram objects
206 
207  This function takes a vector of Mobilogram objects and extracts the intensity
208  values from each Mobilogram, storing them in a 2D vector of doubles. The
209  resulting vector of intensity values is stored in the provided output parameter.
210 
211  @param[in] mobilograms A const reference to a vector of Mobilogram objects
212  from which to extract intensity values.
213  @param[out] int_values A reference to a vector of vector of doubles where
214  the extracted intensity values will be stored. This
215  vector will be cleared and resized as necessary.
216  */
217  static void extractIntensities(const std::vector< Mobilogram >& mobilograms,
218  std::vector<std::vector<double>>& int_values);
219 
229  static std::vector<double> extractIntensities(const Mobilogram& mobilogram);
230 
231  };
232 
233  /*
234  @brief Helper function to sum up aligned mobilograms
235 
236  This function takes a vector of aligned mobilograms and sums them up to create a single Mobilogram object. The resulting Mobilogram object will contain the sum of the intensity values from all the input mobilograms.
237 
238  @note the input vector of Mobilograms all need to have the same size, otherwise the function will throw a pre-condition exception.
239 
240  @param[in] aligned_mobilograms A vector of aligned mobilograms
241  @return A Mobilogram object that is the sum of the input mobilograms
242  */
243  OpenMS::Mobilogram sumAlignedMobilograms(const std::vector<OpenMS::Mobilogram>& aligned_mobilograms);
244 
245  } // namespace OpenMS
A class that calls the ion mobility scoring routines.
Definition: IonMobilityScoring.h:47
MRMTransitionGroup< MSChromatogram, TransitionType > MRMTransitionGroupType
Definition: IonMobilityScoring.h:50
static void driftScoringMS1(const SpectrumSequence &spectra, const std::vector< TransitionType > &transitions, OpenSwath_Scores &scores, const double drift_target, RangeMobility im_range, const double dia_extraction_window_, const bool dia_extraction_ppm_, const double drift_extra)
Performs scoring of the ion mobility dimension in MS1.
static void extractIntensities(const std::vector< Mobilogram > &mobilograms, std::vector< std::vector< double >> &int_values)
static std::vector< double > computeGrid_(const std::vector< Mobilogram > &mobilograms, double eps)
helper function to computeIonMobilogram. Discretizes ion mobility values into a grid.
static void driftScoring(const SpectrumSequence &spectra, const std::vector< TransitionType > &transitions, OpenSwath_Scores &scores, const double drift_target, RangeMobility im_range, const double dia_extraction_window_, const bool dia_extraction_ppm_, const double drift_extra, const bool apply_im_peak_picking)
Performs scoring of the ion mobility dimension in MS2.
static void driftIdScoring(const SpectrumSequence &spectra, const std::vector< TransitionType > &transitions, MRMTransitionGroupType &transition_group_detection, OpenSwath_Scores &scores, const double drift_target, RangeMobility im_range, const double dia_extract_window_, const bool dia_extraction_ppm_, const double drift_extra, const bool apply_im_peak_picking)
Performs scoring of the ion mobility dimension for identification transitions against detection trans...
~IonMobilityScoring()
Destructor.
OpenSwath::LightTransition TransitionType
Definition: IonMobilityScoring.h:49
static void computeIonMobilogram(const SpectrumSequence &spectra, const RangeMZ &mz_range, const RangeMobility &im_range, double &im, double &intensity, Mobilogram &res, double eps)
computes ion mobilogram to be used in scoring based on mz_range and im_range. Also integrates intensi...
static void driftScoringMS1Contrast(const SpectrumSequence &spectra, const SpectrumSequence &ms1spectrum, const std::vector< TransitionType > &transitions, OpenSwath_Scores &scores, RangeMobility im_range, const double dia_extraction_window_, const bool dia_extraction_ppm_, const double drift_extra)
Performs scoring of the ion mobility dimension in MS1 and MS2 (contrast)
OpenSwath::LightCompound CompoundType
Definition: IonMobilityScoring.h:48
static void alignToGrid_(const Mobilogram &profile, const std::vector< double > &im_grid, Mobilogram &aligned_profile, double eps, Size &max_peak_idx)
static std::vector< double > extractIntensities(const Mobilogram &mobilogram)
Extracts intensity values from a single Mobilogram object.
IonMobilityScoring()
Constructor.
The representation of a group of transitions in a targeted proteomics experiment.
Definition: MRMTransitionGroup.h:42
The representation of a 1D ion mobilogram.
Definition: Mobilogram.h:32
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
OpenMS::Mobilogram sumAlignedMobilograms(const std::vector< OpenMS::Mobilogram > &aligned_mobilograms)
std::vector< OpenSwath::SpectrumPtr > SpectrumSequence
a vector of spectrum pointers that DIA scores can operate on, allows for clever integration of only t...
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:20
A structure to hold the different scores computed by OpenSWATH.
Definition: OpenSwathScores.h:57
Definition: RangeManager.h:346
Definition: RangeManager.h:466
Definition: TransitionExperiment.h:127
Definition: TransitionExperiment.h:20