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 {
52  class OPENMS_DLLAPI FLASHIda
53  {
54  public:
57 
59  explicit FLASHIda(char *arg);
60 
62  ~FLASHIda() = default;
63 
65  FLASHIda(const FLASHIda& ) = default;
66 
68  FLASHIda(FLASHIda&& other) = default;
69 
71  FLASHIda& operator=(const FLASHIda& fd) = default;
72 
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 
109  void getIsolationWindows(double *window_start,
110  double *window_end,
111  double *qscores,
112  int *charges,
113  int *min_charges,
114  int *max_charges,
115  double *mono_masses,
116  double *charge_cos,
117  double *charge_snrs,
118  double *iso_cos,
119  double *snrs, double *charge_scores,
120  double *ppm_errors,
121  double *precursor_intensities,
122  double *peakgroup_intensities);
123 
124 
125  void getAllMonoisotopicMasses(double *masses, int length);
126 
128 
134  static std::map<int, std::vector<std::vector<float>>> parseFLASHIdaLog(const String& in_log_file);
135 
136  private:
138  /*struct
139  {
140  bool operator()(const PeakGroup& a, const PeakGroup& b) const
141  {
142  return a.getQScore() > b.getQScore();
143  }
144  } QscoreComparator_;
145 */
147  std::unordered_map<int, double> tqscore_exceeding_mz_rt_map_;
148  std::unordered_map<int, double> tqscore_exceeding_mass_rt_map_;
149  std::unordered_map<int, double> all_mass_rt_map_;
150  std::unordered_map<int, double> mass_qscore_map_;
151 
157  void filterPeakGroupsUsingMassExclusion_(int ms_level, double rt);
158 
169  static MSSpectrum makeMSSpectrum_(const double *mzs,
170  const double *ints,
171  int length,
172  double rt,
173  int ms_level,
174  const char *name);
175 
181  std::vector<int> trigger_charges;
183  std::vector<double> trigger_left_isolation_mzs_;
184  std::vector<double> trigger_right_isolation_mzs_;
185 
188 
190  double tqscore_threshold = .8;
191 
195  double rt_window_;
198 
199  int targeting_mode_ = 0;
200 
202  std::map<double, std::vector<double>> target_mass_rt_map_;
203  std::map<double, std::vector<double>> target_mass_qscore_map_;
204  std::vector<double> target_masses_;
205 
207  std::map<double, std::vector<double>> exclusion_rt_masses_map_;
208  std::vector<double> excluded_masses_;
209 
211  double snr_threshold_ = 1;
212 
215  };
216 }
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: FLASHDeconvHelperStructs.h:166
Averagine patterns pre-calculated for speed up. Other variables are also calculated for fast cosine c...
Definition: FLASHDeconvHelperStructs.h:33
FLASHIda class for real time deconvolution This class contains functions to perform deconvolution (by...
Definition: FLASHIda.h:53
std::vector< double > excluded_masses_
if rt == 0, its mapped masses are always excluded.
Definition: FLASHIda.h:208
double rt_window_
retention time window - determined from C# side
Definition: FLASHIda.h:195
FLASHIda & operator=(const FLASHIda &fd)=default
assignment operator
double qscore_threshold_
q score threshold - determined from C# side
Definition: FLASHIda.h:193
DeconvolvedSpectrum deconvolved_spectrum_
deconvolved spectrum that contains the peak group
Definition: FLASHIda.h:177
std::vector< double > trigger_right_isolation_mzs_
Definition: FLASHIda.h:184
FLASHIda(char *arg)
constructor that takes string input argument
FLASHDeconvHelperStructs::LogMzPeak LogMzPeak
Definition: FLASHIda.h:56
void getAllMonoisotopicMasses(double *masses, int length)
DoubleList tol_
mass tolerance
Definition: FLASHIda.h:214
std::vector< double > target_masses_
Definition: FLASHIda.h:204
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:203
std::unordered_map< int, double > tqscore_exceeding_mz_rt_map_
PeakGroup comparator for soring by QScore.
Definition: FLASHIda.h:147
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:148
std::unordered_map< int, double > all_mass_rt_map_
integer mass value vs. retention time with tqscore exceeding total qscore threshold
Definition: FLASHIda.h:149
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)
get isolation windows using FLASHDeconv algorithm. Many parameters are in primitive types so they can...
std::map< double, std::vector< double > > target_mass_rt_map_
0 no targeting 1 inclusive 2 exclusive
Definition: FLASHIda.h:202
IntList mass_count_
how many masses will be selected per ms level? - determined from C# side
Definition: FLASHIda.h:197
int GetAllPeakGroupSize()
std::vector< double > trigger_left_isolation_mzs_
peakGroup isolation window ranges
Definition: FLASHIda.h:183
SpectralDeconvolution fd_
SpectralDeconvolution class for deconvolution.
Definition: FLASHIda.h:187
std::vector< int > trigger_charges
peakGroup charges to be triggered
Definition: FLASHIda.h:181
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_
current target masses. updated per spectrum
Definition: FLASHIda.h:207
DeconvolvedSpectrum selected_peak_groups_
selected peak groups out of deconvolved_spectrum_
Definition: FLASHIda.h:179
std::unordered_map< int, double > mass_qscore_map_
mz value vs. retention time for all acquired precursors
Definition: FLASHIda.h:150
void filterPeakGroupsUsingMassExclusion_(int ms_level, double rt)
mass value vs. total qscore for all acquired precursors
int getPeakGroups(const double *mzs, const double *intensities, int length, double rt, int ms_level, const char *name)
get peak groups (deconvolved masses) from input spectrum, specified by mzs and intensities (due to C#...
FLASHDeconvHelperStructs::PrecalculatedAveragine PrecalculatedAveragine
Definition: FLASHIda.h:55
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: FeatureDeconvolution.h:22