OpenMS
IonMobilityScoring.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- 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 // scoring
22 
23 #include <vector>
24 namespace OpenMS
25 {
26 
27  struct RangeMobility;
28  struct RangeMZ;
29 
41  class OPENMS_DLLAPI IonMobilityScoring
42  {
45 
46  public:
47 
50 
53 
69  static void driftScoring(const SpectrumSequence& spectra,
70  const std::vector<TransitionType> & transitions,
71  OpenSwath_Scores & scores,
72  const double drift_target,
73  RangeMobility im_range,
74  const double dia_extraction_window_,
75  const bool dia_extraction_ppm_,
76  const bool use_spline,
77  const double drift_extra);
78 
94  static void driftScoringMS1(const SpectrumSequence& spectra,
95  const std::vector<TransitionType> & transitions,
96  OpenSwath_Scores & scores,
97  const double drift_target,
98  RangeMobility im_range,
99  const double dia_extraction_window_,
100  const bool dia_extraction_ppm_,
101  const bool use_spline,
102  const double drift_extra);
103 
118  static void driftScoringMS1Contrast(const SpectrumSequence& spectra, const SpectrumSequence& ms1spectrum,
119  const std::vector<TransitionType> & transitions,
120  OpenSwath_Scores & scores,
121  RangeMobility im_range,
122  const double dia_extraction_window_,
123  const bool dia_extraction_ppm_,
124  const double drift_extra);
125 
138  static void computeIonMobilogram(const SpectrumSequence& spectra,
139  const RangeMZ & mz_range,
140  const RangeMobility & im_range,
141  double & im,
142  double & intensity,
143  Mobilogram & res,
144  double eps);
145 
146 
147  private:
151  static std::vector<double> computeGrid_(const std::vector< Mobilogram >& mobilograms, double eps);
152 
153 
154  /*
155  @brief Extracts ion mobility values projected onto a grid
156 
157  For a given ion mobility profile and a grid, compute an ion mobilogram
158  across the grid for each ion mobility data point. Returns two data arrays
159  for the ion mobilogram: intensity (y) and ion mobility (x). Zero values are
160  inserted if no data point was found for a given grid value.
161 
162  @param profile The ion mobility data
163  @param im_grid The grid to be used
164  @param eps Epsilon used for computing the ion mobility grid
165  @param max_peak_idx The grid position of the maximum
166  */
167  static void alignToGrid_(const Mobilogram& profile,
168  const std::vector<double>& im_grid,
169  Mobilogram & aligned_profile,
170  double eps,
171  Size & max_peak_idx);
172 
173  /*
174  @brief Extracts intensity values from a vector of Mobilogram objects
175 
176  This function takes a vector of Mobilogram objects and extracts the intensity
177  values from each Mobilogram, storing them in a 2D vector of doubles. The
178  resulting vector of intensity values is stored in the provided output parameter.
179 
180  @param[in] mobilograms A const reference to a vector of Mobilogram objects
181  from which to extract intensity values.
182  @param[out] int_values A reference to a vector of vector of doubles where
183  the extracted intensity values will be stored. This
184  vector will be cleared and resized as necessary.
185  */
186  static void extractIntensities(const std::vector< Mobilogram >& mobilograms,
187  std::vector<std::vector<double>>& int_values);
188 
189  };
190 }
191 
A class that calls the ion mobility scoring routines.
Definition: IonMobilityScoring.h:42
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 bool use_spline, const double drift_extra)
Performs scoring of the ion mobility dimension in MS2.
~IonMobilityScoring()
Destructor.
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 bool use_spline, const double drift_extra)
Performs scoring of the ion mobility dimension in MS1.
OpenSwath::LightTransition TransitionType
Definition: IonMobilityScoring.h:44
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:43
static void alignToGrid_(const Mobilogram &profile, const std::vector< double > &im_grid, Mobilogram &aligned_profile, double eps, Size &max_peak_idx)
IonMobilityScoring()
Constructor.
The representation of a 1D ion mobilogram.
Definition: Mobilogram.h:29
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
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