OpenMS
FLASHDeconvHelperStructs.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- 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 
17 namespace OpenMS
18 {
30  struct OPENMS_DLLAPI FLASHDeconvHelperStructs {
32  class OPENMS_DLLAPI PrecalculatedAveragine
33  {
34  private:
36  std::vector<IsotopeDistribution> isotopes_;
38  std::vector<double> norms_;
40  std::vector<double> average_mono_mass_difference_;
42  std::vector<double> abundant_mono_mass_difference_;
44  std::vector<int> left_count_from_apex_;
46  std::vector<int> right_count_from_apex_;
48  std::vector<Size> apex_index_;
49 
55  double min_mass_;
57  Size massToIndex_(double mass) const;
58 
59  public:
62 
71  PrecalculatedAveragine(double min_mass, double max_mass, double delta, CoarseIsotopePatternGenerator& generator, bool use_RNA_averagine);
72 
73 
76 
78  PrecalculatedAveragine(PrecalculatedAveragine&& other) noexcept = default;
79 
82 
85 
88 
89 
91  IsotopeDistribution get(double mass) const;
92 
94  size_t getMaxIsotopeIndex() const;
95 
97  void setMaxIsotopeIndex(int index);
98 
101  Size getLeftCountFromApex(double mass) const;
102 
105  Size getRightCountFromApex(double mass) const;
106 
108  Size getApexIndex(double mass) const;
109 
111  Size getLastIndex(double mass) const;
112 
114  double getAverageMassDelta(double mass) const;
115 
117  double getMostAbundantMassDelta(double mass) const;
118  };
119 
121  struct OPENMS_DLLAPI MassFeature {
122  public:
124  uint index;
126  std::vector<float> per_charge_intensity;
127  std::vector<float> per_isotope_intensity;
129  int scan_number, rep_charge;
130  double avg_mass;
131  int min_charge, max_charge, charge_count;
132  double isotope_score, qscore;
133  double rep_mz;
134  bool is_decoy;
135  uint ms_level;
137  bool operator<(const MassFeature& a) const
138  {
139  return avg_mass < a.avg_mass;
140  }
141  bool operator>(const MassFeature& a) const
142  {
143  return avg_mass > a.avg_mass;
144  }
145  bool operator==(const MassFeature& other) const
146  {
147  return avg_mass == other.avg_mass;
148  }
149  };
150 
152  struct OPENMS_DLLAPI IsobaricQuantities {
153  public:
154  int scan;
155  double rt;
156  double precursor_mz;
158  std::vector<double> quantities;
159  std::vector<double> merged_quantities;
160 
161  bool empty() const;
162  };
163 
165  class OPENMS_DLLAPI LogMzPeak
166  {
167  public:
169  double mz = 0;
171  float intensity = 0;
173  double logMz = -1000;
175  double mass = .0;
177  int abs_charge = 0;
179  bool is_positive = true;
181  int isotopeIndex = -1;
182 
184  LogMzPeak() = default;
185 
191  explicit LogMzPeak(const Peak1D& peak, bool positive);
192 
194  LogMzPeak(const LogMzPeak&) = default;
195 
197  ~LogMzPeak() = default;
198 
200  double getUnchargedMass() const;
201 
203  bool operator<(const LogMzPeak& a) const;
204  bool operator>(const LogMzPeak& a) const;
205  bool operator==(const LogMzPeak& other) const;
206  };
207 
209  class OPENMS_DLLAPI Tag
210  {
211  public:
213  explicit Tag(String seq, double n_mass, double c_mass, int charge, double score, std::vector<double>& mzs);
214 
216  Tag(const Tag&) = default;
217 
219  ~Tag() = default;
220 
221  bool operator<(const Tag& a) const;
222  bool operator>(const Tag& a) const;
223  bool operator==(const Tag& other) const;
224 
226  double getNtermMass() const;
227  double getCtermMass() const;
228  int getCharge() const;
229  Size getLength() const;
230  double getScore() const;
231  String toString() const;
232  const std::vector<double>& getMzs() const;
233 
234  private:
236  double n_mass_ = -1, c_mass_ = -1;
237  int charge_;
238  double score_;
239  std::vector<double> mzs_;
241  };
242 
248  static double getLogMz(double mz, bool positive);
249 
254  static float getChargeMass(bool positive_ioniziation_mode);
255  };
256 } // 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: FLASHDeconvHelperStructs.h:166
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
double getUnchargedMass() const
get uncharged mass of this peak. It is NOT a monoisotopic mass of a PeakGroup, rather a monoisotopic ...
Averagine patterns pre-calculated for speed up. Other variables are also calculated for fast cosine c...
Definition: FLASHDeconvHelperStructs.h:33
Size getApexIndex(double mass) const
get index of most abundant isotope. If input mass exceeds the maximum mass (specified in constructor)...
void setMaxIsotopeIndex(int index)
set max isotope index
std::vector< double > norms_
L2 norms_ for masses.
Definition: FLASHDeconvHelperStructs.h:38
std::vector< double > average_mono_mass_difference_
mass differences between average mass and monoisotopic mass
Definition: FLASHDeconvHelperStructs.h:40
Size max_isotope_index_
max isotope index
Definition: FLASHDeconvHelperStructs.h:51
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: FLASHDeconvHelperStructs.h:55
double getAverageMassDelta(double mass) const
get mass difference between avg and mono masses. If input mass exceeds the maximum mass (specified in...
double mass_interval_
mass interval for calculation
Definition: FLASHDeconvHelperStructs.h:53
PrecalculatedAveragine & operator=(const PrecalculatedAveragine &pc)=default
copy assignment operator
Size massToIndex_(double mass) const
calculate the mass bin index from mass
double getMostAbundantMassDelta(double mass) const
get mass difference between most abundant mass and mono masses. If input mass exceeds the maximum mas...
std::vector< double > abundant_mono_mass_difference_
mass differences between most abundant mass and monoisotopic mass
Definition: FLASHDeconvHelperStructs.h:42
Size getLastIndex(double mass) const
get index of last isotope. If input mass exceeds the maximum mass (specified in constructor),...
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: FLASHDeconvHelperStructs.h:36
std::vector< Size > apex_index_
most abundant isotope index
Definition: FLASHDeconvHelperStructs.h:48
std::vector< int > left_count_from_apex_
Isotope start indices: isotopes of the indices less than them have very low intensities.
Definition: FLASHDeconvHelperStructs.h:44
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: FLASHDeconvHelperStructs.h:46
PrecalculatedAveragine(double min_mass, double max_mass, double delta, CoarseIsotopePatternGenerator &generator, bool use_RNA_averagine)
constructor with parameters such as mass ranges and bin size.
Sequence tag. No mass gap is allowed in the seq. The mass gap containing tag should be enumerated int...
Definition: FLASHDeconvHelperStructs.h:210
String seq_
Definition: FLASHDeconvHelperStructs.h:235
Tag(String seq, double n_mass, double c_mass, int charge, double score, std::vector< double > &mzs)
constructor
Size length_
Definition: FLASHDeconvHelperStructs.h:240
const std::vector< double > & getMzs() const
int charge_
Definition: FLASHDeconvHelperStructs.h:237
Tag(const Tag &)=default
copy constructor
bool operator<(const Tag &a) const
std::vector< double > mzs_
Definition: FLASHDeconvHelperStructs.h:239
bool operator>(const Tag &a) const
double score_
Definition: FLASHDeconvHelperStructs.h:238
bool operator==(const Tag &other) const
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
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
FLASHIda C++ to C# (or vice versa) bridge functions The functions here are called in C# to invoke fun...
Definition: FeatureDeconvolution.h:22
Isobaric quantities.
Definition: FLASHDeconvHelperStructs.h:152
int scan
Definition: FLASHDeconvHelperStructs.h:154
std::vector< double > quantities
Definition: FLASHDeconvHelperStructs.h:158
std::vector< double > merged_quantities
Definition: FLASHDeconvHelperStructs.h:159
double precursor_mass
Definition: FLASHDeconvHelperStructs.h:157
double rt
Definition: FLASHDeconvHelperStructs.h:155
double precursor_mz
Definition: FLASHDeconvHelperStructs.h:156
Mass feature (Deconvolved masses in spectra are traced by Mass tracing to generate mass features - li...
Definition: FLASHDeconvHelperStructs.h:121
bool operator<(const MassFeature &a) const
features are compared
Definition: FLASHDeconvHelperStructs.h:137
double avg_mass
Definition: FLASHDeconvHelperStructs.h:130
std::vector< float > per_charge_intensity
Definition: FLASHDeconvHelperStructs.h:126
uint index
feature index;
Definition: FLASHDeconvHelperStructs.h:124
bool operator>(const MassFeature &a) const
Definition: FLASHDeconvHelperStructs.h:141
bool is_decoy
Definition: FLASHDeconvHelperStructs.h:134
int iso_offset
Definition: FLASHDeconvHelperStructs.h:128
std::vector< float > per_isotope_intensity
Definition: FLASHDeconvHelperStructs.h:127
uint ms_level
Definition: FLASHDeconvHelperStructs.h:135
double rep_mz
Definition: FLASHDeconvHelperStructs.h:133
MassTrace mt
Definition: FLASHDeconvHelperStructs.h:125
bool operator==(const MassFeature &other) const
Definition: FLASHDeconvHelperStructs.h:145
int charge_count
Definition: FLASHDeconvHelperStructs.h:131
double isotope_score
Definition: FLASHDeconvHelperStructs.h:132
int rep_charge
Definition: FLASHDeconvHelperStructs.h:129
Wrapper struct for all the structs needed by the FLASHDeconv Three structures are defined: Precalcula...
Definition: FLASHDeconvHelperStructs.h:30
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 ...