OpenMS
FLASHHelperClasses.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: Kyowon Jeong, Jihyung Kim $
6 // $Authors: Kyowon Jeong, Jihyung Kim $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
16 #include <boost/dynamic_bitset.hpp>
17 
18 namespace OpenMS
19 {
35  struct OPENMS_DLLAPI FLASHHelperClasses
36  {
38  class OPENMS_DLLAPI PrecalculatedAveragine
39  {
40  private:
42  std::vector<IsotopeDistribution> isotopes_;
44  std::vector<double> norms_;
46  std::vector<double> average_mono_mass_difference_;
48  std::vector<double> abundant_mono_mass_difference_;
49 
50  std::vector<double> snr_mul_factor_;
52  std::vector<int> left_count_from_apex_;
54  std::vector<int> right_count_from_apex_;
56  std::vector<Size> apex_index_;
57 
63  double min_mass_;
65  Size massToIndex_(double mass) const;
66 
67  public:
70 
80  PrecalculatedAveragine(double min_mass, double max_mass, double delta, CoarseIsotopePatternGenerator& generator, bool use_RNA_averagine, double decoy_iso_distance = -1);
81 
84 
86  PrecalculatedAveragine(PrecalculatedAveragine&& other) noexcept = default;
87 
90 
93 
96 
97 
99  IsotopeDistribution get(double mass) const;
100 
102  size_t getMaxIsotopeIndex() const;
103 
105  void setMaxIsotopeIndex(int index);
106 
109  Size getLeftCountFromApex(double mass) const;
110 
113  Size getRightCountFromApex(double mass) const;
114 
116  Size getApexIndex(double mass) const;
117 
119  Size getLastIndex(double mass) const;
120 
123  double getAverageMassDelta(double mass) const;
124 
127  double getMostAbundantMassDelta(double mass) const;
128 
130  double getSNRMultiplicationFactor(double mass) const;
131  };
132 
134  struct OPENMS_DLLAPI MassFeature
135  {
136  public:
138  uint index;
142  std::vector<float> per_charge_intensity;
143  std::vector<float> per_isotope_intensity;
147  int scan_number, min_scan_number, max_scan_number, rep_charge;
149  double avg_mass;
151  int min_charge, max_charge, charge_count;
152  double isotope_score, qscore;
153  double rep_mz;
154  bool is_decoy;
155  uint ms_level;
157  bool operator<(const MassFeature& a) const
158  {
159  return avg_mass < a.avg_mass;
160  }
161  bool operator>(const MassFeature& a) const
162  {
163  return avg_mass > a.avg_mass;
164  }
165  bool operator==(const MassFeature& other) const
166  {
167  return avg_mass == other.avg_mass;
168  }
169  };
170 
172  struct OPENMS_DLLAPI IsobaricQuantities
173  {
174  public:
175  int scan;
176  double rt;
177  double precursor_mz;
179  std::vector<double> quantities;
180  std::vector<double> merged_quantities;
182  bool empty() const;
183  };
184 
186  class OPENMS_DLLAPI LogMzPeak
187  {
188  public:
190  double mz = 0;
192  float intensity = 0;
194  double logMz = -1000;
196  double mass = .0;
198  int abs_charge = 0;
200  bool is_positive = true;
202  int isotopeIndex = -1;
203 
205  LogMzPeak() = default;
206 
214  explicit LogMzPeak(const Peak1D& peak, bool positive);
215 
217  LogMzPeak(const LogMzPeak&) = default;
218 
220  ~LogMzPeak() = default;
221 
224  double getUnchargedMass() const;
225 
227  bool operator<(const LogMzPeak& a) const;
228  bool operator>(const LogMzPeak& a) const;
229  bool operator==(const LogMzPeak& other) const;
230  };
231 
237  static double getLogMz(double mz, bool positive);
238 
243  static float getChargeMass(bool positive_ioniziation_mode);
244  };
245 } // namespace OpenMS
Isotope pattern generator for coarse isotope distributions.
Definition: CoarseIsotopePatternGenerator.h:79
log transformed peak. After deconvolution, all necessary information from deconvolution such as charg...
Definition: FLASHHelperClasses.h:187
bool operator>(const LogMzPeak &a) const
bool operator<(const LogMzPeak &a) const
log mz values are compared
LogMzPeak(const Peak1D &peak, bool positive)
constructor from Peak1D.
LogMzPeak()=default
default constructor
bool operator==(const LogMzPeak &other) const
LogMzPeak(const LogMzPeak &)=default
copy constructor
Averagine patterns pre-calculated for speed up. Other variables are also calculated for fast cosine c...
Definition: FLASHHelperClasses.h:39
Size getApexIndex(double mass) const
get index of most abundant isotope. If input mass exceeds the maximum mass (specified in constructor)...
double getSNRMultiplicationFactor(double mass) const
get the SNR multiplication factor - used for quick SNR calculation
void setMaxIsotopeIndex(int index)
set max isotope index
std::vector< double > norms_
L2 norms_ for masses - for quick isotope cosine calculation.
Definition: FLASHHelperClasses.h:44
std::vector< double > average_mono_mass_difference_
mass differences between average mass and monoisotopic mass
Definition: FLASHHelperClasses.h:46
PrecalculatedAveragine()=default
default constructor
Size max_isotope_index_
max isotope index
Definition: FLASHHelperClasses.h:59
PrecalculatedAveragine & operator=(PrecalculatedAveragine &&pc) noexcept=default
move assignment operator
size_t getMaxIsotopeIndex() const
get max isotope index
double min_mass_
min mass for calculation
Definition: FLASHHelperClasses.h:63
double mass_interval_
mass interval for calculation
Definition: FLASHHelperClasses.h:61
PrecalculatedAveragine & operator=(const PrecalculatedAveragine &pc)=default
copy assignment operator
Size massToIndex_(double mass) const
calculate the mass bin index from mass
std::vector< double > abundant_mono_mass_difference_
mass differences between most abundant mass and monoisotopic mass
Definition: FLASHHelperClasses.h:48
std::vector< double > snr_mul_factor_
Definition: FLASHHelperClasses.h:50
Size getLastIndex(double mass) const
get index of last isotope. If input mass exceeds the maximum mass (specified in constructor),...
PrecalculatedAveragine(double min_mass, double max_mass, double delta, CoarseIsotopePatternGenerator &generator, bool use_RNA_averagine, double decoy_iso_distance=-1)
constructor with parameters such as mass ranges and bin size.
IsotopeDistribution get(double mass) const
get distribution for input mass. If input mass exceeds the maximum mass (specified in constructor),...
std::vector< IsotopeDistribution > isotopes_
isotope distributions for different (binned) masses
Definition: FLASHHelperClasses.h:42
std::vector< Size > apex_index_
most abundant isotope index
Definition: FLASHHelperClasses.h:56
std::vector< int > left_count_from_apex_
Isotope start indices: isotopes of the indices less than them have very low intensities.
Definition: FLASHHelperClasses.h:52
PrecalculatedAveragine(PrecalculatedAveragine &&other) noexcept=default
move constructor
PrecalculatedAveragine(const PrecalculatedAveragine &)=default
copy constructor
std::vector< int > right_count_from_apex_
Isotope end indices: isotopes of the indices larger than them have very low intensities.
Definition: FLASHHelperClasses.h:54
Definition: IsotopeDistribution.h:39
A container type that gathers peaks similar in m/z and moving along retention time.
Definition: MassTrace.h:36
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:28
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
Isobaric quantities.
Definition: FLASHHelperClasses.h:173
int scan
Definition: FLASHHelperClasses.h:175
std::vector< double > quantities
Definition: FLASHHelperClasses.h:179
bool empty() const
return true if no isobaric quantities have been stored
std::vector< double > merged_quantities
Definition: FLASHHelperClasses.h:180
double precursor_mass
Definition: FLASHHelperClasses.h:178
double rt
Definition: FLASHHelperClasses.h:176
double precursor_mz
Definition: FLASHHelperClasses.h:177
Mass feature (Deconvolved masses in spectra are traced by Mass tracing to generate mass features - li...
Definition: FLASHHelperClasses.h:135
bool operator<(const MassFeature &a) const
features are compared
Definition: FLASHHelperClasses.h:157
double avg_mass
average mass
Definition: FLASHHelperClasses.h:149
std::vector< float > per_charge_intensity
per charge and isotope intensities
Definition: FLASHHelperClasses.h:142
uint index
feature index;
Definition: FLASHHelperClasses.h:138
bool operator>(const MassFeature &a) const
Definition: FLASHHelperClasses.h:161
bool is_decoy
Definition: FLASHHelperClasses.h:154
int iso_offset
isotope offset between deconvolved masses and mass feature
Definition: FLASHHelperClasses.h:145
std::vector< float > per_isotope_intensity
Definition: FLASHHelperClasses.h:143
uint ms_level
Definition: FLASHHelperClasses.h:155
double rep_mz
Definition: FLASHHelperClasses.h:153
MassTrace mt
the trace calculated from the masses
Definition: FLASHHelperClasses.h:140
bool operator==(const MassFeature &other) const
Definition: FLASHHelperClasses.h:165
int charge_count
Definition: FLASHHelperClasses.h:151
double isotope_score
Definition: FLASHHelperClasses.h:152
int max_scan_number
Definition: FLASHHelperClasses.h:147
Wrapper struct for all the structs needed by the FLASHDeconv The following structures/classes are def...
Definition: FLASHHelperClasses.h:36
static double getLogMz(double mz, bool positive)
calculate log mzs from mzs
static float getChargeMass(bool positive_ioniziation_mode)
get charge carrier mass : positive mode mass of (Constants::PROTON_MASS_U) and negative mode mass of ...