OpenMS
FLASHIda.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-2022.
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: Kyowon Jeong $
32 // $Authors: Kyowon Jeong $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
41 
42 namespace OpenMS
43 {
51  class OPENMS_DLLAPI FLASHIda
52  {
53  public:
56 
58  explicit FLASHIda(char *arg);
59 
61  ~FLASHIda() = default;
62 
64  FLASHIda(const FLASHIda& ) = default;
65 
67  FLASHIda(FLASHIda&& other) = default;
68 
70  FLASHIda& operator=(const FLASHIda& fd) = default;
71 
83  int getPeakGroups(const double *mzs,
84  const double *intensities,
85  int length,
86  double rt,
87  int ms_level,
88  const char *name,
89  const char *cv);
90 
111  void getIsolationWindows(double *window_start,
112  double *window_end,
113  double *qscores,
114  int *charges,
115  int *min_charges,
116  int *max_charges,
117  double *mono_masses,
118  double *charge_cos,
119  double *charge_snrs,
120  double *iso_cos,
121  double *snrs, double *charge_scores,
122  double *ppm_errors,
123  double *precursor_intensities,
124  double *peakgroup_intensities,
125  int *ids);
131 
133 
134  void getAllMonoisotopicMasses(double *masses, int length);
135 
137 
143  static std::map<int, std::vector<std::vector<float>>> parseFLASHIdaLog(const String& in_log_file);
144 
145  private:
147  /*struct
148  {
149  bool operator()(const PeakGroup& a, const PeakGroup& b) const
150  {
151  return a.getQScore() > b.getQScore();
152  }
153  } QscoreComparator_;
154 */
156  std::unordered_map<int, double> tqscore_exceeding_mz_rt_map_;
157  std::unordered_map<int, double> tqscore_exceeding_mass_rt_map_;
158  std::unordered_map<int, double> all_mass_rt_map_;
159  std::unordered_map<int, double> mass_qscore_map_;
160 
161 
162 
164  std::unordered_map<int, int> id_mass_map_;
165  std::unordered_map<int, int> id_mz_map_;
166  std::unordered_map<int, double> id_qscore_map_;
167 
168 
174  void filterPeakGroupsUsingMassExclusion_(int ms_level, double rt);
175 
186  static MSSpectrum makeMSSpectrum_(const double *mzs,
187  const double *ints,
188  int length,
189  double rt,
190  int ms_level,
191  const char *name);
192 
198  std::vector<int> trigger_charges;
200  std::vector<double> trigger_left_isolation_mzs_;
201  std::vector<double> trigger_right_isolation_mzs_;
202  std::vector<int> trigger_ids_;
203 
206 
208  double tqscore_threshold = .99;
209 
213  double rt_window_;
216 
217  int targeting_mode_ = 0;
218 
220  std::map<double, std::vector<double>> target_mass_rt_map_;
221  std::map<double, std::vector<double>> target_mass_qscore_map_;
222  std::vector<double> target_masses_;
223 
224  // For the possibility of removal each window is given an id, starting at zero (needed for FAIMS support)
225  int window_id_ = 0;
226 
228  std::map<double, std::vector<double>> exclusion_rt_masses_map_;
229  std::vector<double> excluded_masses_;
230 
232  double snr_threshold_ = 1;
233 
236 
237  std::map<double, std::vector<double>> cv_to_mass_ = {
238  {-80.0, {2400.0, 2900.0}},
239  {-70.0, {3500.0, 4000.0}},
240  {-60.0, {4500.0, 5000.0}},
241  {-50.0, {5100.0, 6500.0}},
242  {-40.0, {7500.0, 10000.0}},
243  {-30.0, {11000.0, 14000.0}},
244  {-20.0, {12000.0, 15000.0}},
245  {-10.0, {13000.0, 15500.0}},
246  {-0.0, {14000.0, 16000.0}},
247  {10.0, {15000.0, 16500.0}},
248  };
249 
250  };
251 }
A class representing a deconvolved spectrum. DeconvolvedSpectrum consists of PeakGroups representing ...
Definition: DeconvolvedSpectrum.h:30
log transformed peak. After deconvolution, all necessary information from deconvolution such as charg...
Definition: FLASHHelperClasses.h:177
Averagine patterns pre-calculated for speed up. Other variables are also calculated for fast cosine c...
Definition: FLASHHelperClasses.h:35
FLASHIda class for real time deconvolution This class contains functions to perform deconvolution (by...
Definition: FLASHIda.h:52
std::vector< double > excluded_masses_
if rt == 0, its mapped masses are always excluded.
Definition: FLASHIda.h:229
FLASHHelperClasses::PrecalculatedAveragine PrecalculatedAveragine
Definition: FLASHIda.h:54
double rt_window_
retention time window - determined from C# side
Definition: FLASHIda.h:213
FLASHIda & operator=(const FLASHIda &fd)=default
assignment operator
std::unordered_map< int, int > id_mz_map_
Definition: FLASHIda.h:165
double qscore_threshold_
q score threshold - determined from C# side
Definition: FLASHIda.h:211
int getPeakGroups(const double *mzs, const double *intensities, int length, double rt, int ms_level, const char *name, const char *cv)
get peak groups (deconvolved masses) from input spectrum, specified by mzs and intensities (due to C#...
DeconvolvedSpectrum deconvolved_spectrum_
deconvolved spectrum that contains the peak group
Definition: FLASHIda.h:194
std::unordered_map< int, double > id_qscore_map_
Definition: FLASHIda.h:166
std::vector< double > trigger_right_isolation_mzs_
Definition: FLASHIda.h:201
FLASHIda(char *arg)
constructor that takes string input argument
void getAllMonoisotopicMasses(double *masses, int length)
DoubleList tol_
mass tolerance
Definition: FLASHIda.h:235
std::vector< double > target_masses_
Definition: FLASHIda.h:222
static std::map< int, std::vector< std::vector< float > > > parseFLASHIdaLog(const String &in_log_file)
parse FLASHIda log file
FLASHIda(const FLASHIda &)=default
copy constructor
std::map< double, std::vector< double > > target_mass_qscore_map_
Definition: FLASHIda.h:221
std::unordered_map< int, double > tqscore_exceeding_mz_rt_map_
PeakGroup comparator for soring by QScore.
Definition: FLASHIda.h:156
std::unordered_map< int, double > tqscore_exceeding_mass_rt_map_
integer mz value vs. retention time with tqscore exceeding total qscore threshold
Definition: FLASHIda.h:157
std::unordered_map< int, double > all_mass_rt_map_
integer mass value vs. retention time with tqscore exceeding total qscore threshold
Definition: FLASHIda.h:158
std::map< double, std::vector< double > > target_mass_rt_map_
0 no targeting 1 inclusive 2 exclusive
Definition: FLASHIda.h:220
IntList mass_count_
how many masses will be selected per ms level? - determined from C# side
Definition: FLASHIda.h:215
int GetAllPeakGroupSize()
std::vector< double > trigger_left_isolation_mzs_
peakGroup isolation window ranges
Definition: FLASHIda.h:200
std::unordered_map< int, int > id_mass_map_
mass value vs. total qscore for all acquired precursors
Definition: FLASHIda.h:164
SpectralDeconvolution fd_
SpectralDeconvolution class for deconvolution.
Definition: FLASHIda.h:205
void getIsolationWindows(double *window_start, double *window_end, double *qscores, int *charges, int *min_charges, int *max_charges, double *mono_masses, double *charge_cos, double *charge_snrs, double *iso_cos, double *snrs, double *charge_scores, double *ppm_errors, double *precursor_intensities, double *peakgroup_intensities, int *ids)
get isolation windows using FLASHDeconv algorithm. Many parameters are in primitive types so they can...
std::vector< int > trigger_charges
peakGroup charges to be triggered
Definition: FLASHIda.h:198
static MSSpectrum makeMSSpectrum_(const double *mzs, const double *ints, int length, double rt, int ms_level, const char *name)
generate MSSpectrum class using mzs and intensities. mzs and intensities and other information are pr...
~FLASHIda()=default
destructor
std::map< double, std::vector< double > > exclusion_rt_masses_map_
maps for global exclusion
Definition: FLASHIda.h:228
std::vector< int > trigger_ids_
Definition: FLASHIda.h:202
FLASHHelperClasses::LogMzPeak LogMzPeak
Definition: FLASHIda.h:55
void removeFromExlusionList(int id)
Remove a given precursor from the exclusion list by id (needed for FAIMS)
DeconvolvedSpectrum selected_peak_groups_
selected peak groups out of deconvolved_spectrum_
Definition: FLASHIda.h:196
std::unordered_map< int, double > mass_qscore_map_
mz value vs. retention time for all acquired precursors
Definition: FLASHIda.h:159
void filterPeakGroupsUsingMassExclusion_(int ms_level, double rt)
discard peak groups using mass exclusion
double getRepresentativeMass()
FLASHIda(FLASHIda &&other)=default
move constructor
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
FLASHDeconv algorithm: ultrafast mass deconvolution algorithm for top down mass spectrometry dataset ...
Definition: SpectralDeconvolution.h:34
A more convenient string class.
Definition: String.h:34
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:29
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:36
FLASHIda C++ to C# (or vice versa) bridge functions The functions here are called in C# to invoke fun...
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19