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
31  {
33  class OPENMS_DLLAPI PrecalculatedAveragine
34  {
35  private:
37  std::vector<IsotopeDistribution> isotopes_;
39  std::vector<double> norms_;
41  std::vector<double> average_mono_mass_difference_;
43  std::vector<double> abundant_mono_mass_difference_;
45  std::vector<int> left_count_from_apex_;
47  std::vector<int> right_count_from_apex_;
49  std::vector<Size> apex_index_;
50 
56  double min_mass_;
58  Size massToIndex_(double mass) const;
59  public:
62 
71  PrecalculatedAveragine(double min_mass,
72  double max_mass,
73  double delta,
75  bool use_RNA_averagine);
76 
77 
80 
82  PrecalculatedAveragine(PrecalculatedAveragine&& other) noexcept = default;
83 
86 
89 
92 
93 
95  IsotopeDistribution get(double mass) const;
96 
98  size_t getMaxIsotopeIndex() const;
99 
101  void setMaxIsotopeIndex(int index);
102 
104  Size getLeftCountFromApex(double mass) const;
105 
107  Size getRightCountFromApex(double mass) const;
108 
110  Size getApexIndex(double mass) const;
111 
113  Size getLastIndex(double mass) const;
114 
116  double getAverageMassDelta(double mass) const;
117 
119  double getMostAbundantMassDelta(double mass) const;
120  };
121 
123  struct OPENMS_DLLAPI MassFeature
124  {
125  public:
127  std::vector<float> per_charge_intensity;
128  std::vector<float> per_isotope_intensity;
130  int scan_number, rep_charge;
131  double avg_mass;
132  int min_charge, max_charge, charge_count;
133  double isotope_score, qscore;
134  double rep_mz;
135  };
136 
138  class OPENMS_DLLAPI LogMzPeak
139  {
140  public:
142  double mz = 0;
144  float intensity = 0;
146  double logMz = -1000;
148  double mass = .0;
150  int abs_charge = 0;
152  bool is_positive = true;
154  int isotopeIndex = -1;
155 
157  LogMzPeak() = default;
158 
163  explicit LogMzPeak(const Peak1D& peak, bool positive);
164 
166  LogMzPeak(const LogMzPeak& ) = default;
167 
169  ~LogMzPeak() = default;
170 
173 
175  bool operator<(const LogMzPeak& a) const;
176  bool operator>(const LogMzPeak& a) const;
177  bool operator==(const LogMzPeak& other) const;
178  };
179 
185  static double getLogMz(double mz, bool positive);
186 
191  static float getChargeMass(bool positive_ioniziation_mode);
192  };
193 }
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:139
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
double getUnchargedMass()
get uncharged mass of this peak. It is NOT a monoisotopic mass of a PeakGroup, rather a monoisotopic ...
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: FLASHDeconvHelperStructs.h:34
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:39
std::vector< double > average_mono_mass_difference_
mass differences between average mass and monoisotopic mass
Definition: FLASHDeconvHelperStructs.h:41
Size max_isotope_index_
max isotope index
Definition: FLASHDeconvHelperStructs.h:52
PrecalculatedAveragine & operator=(PrecalculatedAveragine &&pc) noexcept=default
move assignment operator
size_t getMaxIsotopeIndex() const
get max isotope index
Size getRightCountFromApex(double mass) const
get isotope distance (from apex to the rigth direction) to consider. This is specified in the constru...
double min_mass_
min mass for calculation
Definition: FLASHDeconvHelperStructs.h:56
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:54
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:43
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:37
std::vector< Size > apex_index_
most abundant isotope index
Definition: FLASHDeconvHelperStructs.h:49
std::vector< int > left_count_from_apex_
Isotope start indices: isotopes of the indices less than them have very low intensities.
Definition: FLASHDeconvHelperStructs.h:45
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:47
Size getLeftCountFromApex(double mass) const
get isotope distance (from apex to the left direction) to consider. This is specified in the construc...
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.
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:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Wrapper struct for all the structs needed by the FLASHDeconv Three structures are defined: Precalcula...
Definition: FLASHDeconvHelperStructs.h:31
static double getLogMz(double mz, bool positive)
calculate log mzs from mzs
double avg_mass
Definition: FLASHDeconvHelperStructs.h:131
std::vector< float > per_charge_intensity
Definition: FLASHDeconvHelperStructs.h:127
int iso_offset
Definition: FLASHDeconvHelperStructs.h:129
std::vector< float > per_isotope_intensity
Definition: FLASHDeconvHelperStructs.h:128
static float getChargeMass(bool positive_ioniziation_mode)
get charge carrier mass : positive mode mass of (Constants::PROTON_MASS_U) and negative mode mass of ...
double rep_mz
Definition: FLASHDeconvHelperStructs.h:134
MassTrace mt
Definition: FLASHDeconvHelperStructs.h:126
int charge_count
Definition: FLASHDeconvHelperStructs.h:132
double isotope_score
Definition: FLASHDeconvHelperStructs.h:133
int rep_charge
Definition: FLASHDeconvHelperStructs.h:130
Mass feature (Deconvolved masses in spectra are traced by Mass tracing to generate mass features - li...
Definition: FLASHDeconvHelperStructs.h:124