OpenMS  3.0.0
FLASHDeconvHelperStructs.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, Jihyung Kim $
32 // $Authors: Kyowon Jeong, Jihyung Kim $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
42 
43 namespace OpenMS
44 {
56  struct OPENMS_DLLAPI FLASHDeconvHelperStructs
57  {
59  class OPENMS_DLLAPI PrecalculatedAveragine
60  {
61  private:
63  std::vector<IsotopeDistribution> isotopes_;
65  std::vector<double> norms_;
67  std::vector<double> average_mono_mass_difference_;
69  std::vector<double> abundant_mono_mass_difference_;
71  std::vector<int> left_count_from_apex_;
73  std::vector<int> right_count_from_apex_;
75  std::vector<Size> apex_index_;
76 
82  double min_mass_;
84  Size massToIndex_(double const mass) const;
85  public:
88 
97  PrecalculatedAveragine(const double min_mass,
98  const double max_mass,
99  const double delta,
101  const bool use_RNA_averagine);
102 
104  IsotopeDistribution get(const double mass) const;
105 
107  int getMaxIsotopeIndex() const;
108 
110  void setMaxIsotopeIndex(const int index);
111 
113  Size getLeftCountFromApex(const double mass) const;
114 
116  Size getRightCountFromApex(const double mass) const;
117 
119  Size getApexIndex(const double mass) const;
120 
122  Size getLastIndex(const double mass) const;
123 
125  double getAverageMassDelta(const double mass) const;
126 
128  double getMostAbundantMassDelta(const double mass) const;
129  };
130 
132  struct OPENMS_DLLAPI TopPicItem
133  {
134  public:
135  TopPicItem() = default;
136 
142  explicit TopPicItem(String in);
143 
147  int prsm_id;
148  int spec_id;
149  int scan;
150  double rt;
152  int charge;
155  int proteform_id = -1;
156  String protein_acc = "";
159  std::vector<double> unexp_mod;
162  double e_value;
163  double spec_q_value;
165  double intensity;
166 
168  bool operator<(const TopPicItem& a) const;
169 
170  bool operator>(const TopPicItem& a) const;
171 
172  bool operator==(const TopPicItem& other) const;
173  };
174 
176  struct OPENMS_DLLAPI MassFeature
177  {
178  public:
180  std::vector<float> per_charge_intensity;
181  std::vector<float> per_isotope_intensity;
183  int scan_number, rep_charge;
184  double avg_mass;
185  int min_charge, max_charge, charge_count;
186  double isotope_score, qscore;
187  double rep_mz;
188  };
189 
191  class OPENMS_DLLAPI LogMzPeak
192  {
193  public:
195  double mz = 0;
197  double intensity = 0;
199  double logMz = -1000;
201  double mass = .0;
203  int abs_charge = 0;
205  bool is_positive = true;
207  int isotopeIndex = -1;
208 
210  LogMzPeak() = default;
211 
216  explicit LogMzPeak(const Peak1D& peak, const bool positive);
217 
219  LogMzPeak(const LogMzPeak& ) = default;
220 
222  ~LogMzPeak() = default;
223 
226 
228  bool operator<(const LogMzPeak& a) const;
229 
230  bool operator>(const LogMzPeak& a) const;
231 
232  bool operator==(const LogMzPeak& other) const;
233 
234  };
235 
241  static double getLogMz(const double mz, const bool positive);
242 
246  static double getChargeMass(const bool positive);
247 
248  };
249 }
Isotope pattern generator for coarse isotope distributions.
Definition: CoarseIsotopePatternGenerator.h:105
log transformed peak. After deconvolution, all necessary information from deconvolution such as charg...
Definition: FLASHDeconvHelperStructs.h:192
bool operator>(const LogMzPeak &a) const
bool operator<(const LogMzPeak &a) const
log mz values are compared
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
LogMzPeak(const Peak1D &peak, const bool positive)
constructor from Peak1D.
Averagine patterns pre-calculated for speed up. Other variables are also calculated for fast cosine c...
Definition: FLASHDeconvHelperStructs.h:60
std::vector< double > norms_
L2 norms_ for masses.
Definition: FLASHDeconvHelperStructs.h:65
std::vector< double > average_mono_mass_difference_
mass differences between average mass and monoisotopic mass
Definition: FLASHDeconvHelperStructs.h:67
Size max_isotope_index_
max isotope index
Definition: FLASHDeconvHelperStructs.h:78
Size getApexIndex(const double mass) const
get index of most abundant isotope. If input mass exceeds the maximum mass (specified in constructor)...
Size massToIndex_(double const mass) const
calculate the mass bin index from mass
Size getLastIndex(const double mass) const
get index of last isotope. If input mass exceeds the maximum mass (specified in constructor),...
double min_mass_
min mass for calculation
Definition: FLASHDeconvHelperStructs.h:82
double getMostAbundantMassDelta(const double mass) const
get mass difference between most abundant mass and mono masses. If input mass exceeds the maximum mas...
double mass_interval_
mass interval for calculation
Definition: FLASHDeconvHelperStructs.h:80
IsotopeDistribution get(const double mass) const
get distribution for input mass. If input mass exceeds the maximum mass (specified in constructor),...
Size getRightCountFromApex(const double mass) const
get isotope distance (from apex to the rigth direction) to consider. This is specified in the constru...
std::vector< double > abundant_mono_mass_difference_
mass differences between most abundant mass and monoisotopic mass
Definition: FLASHDeconvHelperStructs.h:69
int getMaxIsotopeIndex() const
get max isotope index
Size getLeftCountFromApex(const double mass) const
get isotope distance (from apex to the left direction) to consider. This is specified in the construc...
void setMaxIsotopeIndex(const int index)
set max isotope index
std::vector< IsotopeDistribution > isotopes_
isotope distributions for different (binned) masses
Definition: FLASHDeconvHelperStructs.h:63
std::vector< Size > apex_index_
most abundant isotope index
Definition: FLASHDeconvHelperStructs.h:75
std::vector< int > left_count_from_apex_
Isotope start indices: isotopes of the indices less than them have very low intensities.
Definition: FLASHDeconvHelperStructs.h:71
double getAverageMassDelta(const double mass) const
get mass difference between avg and mono masses. If input mass exceeds the maximum mass (specified in...
std::vector< int > right_count_from_apex_
Isotope end indices: isotopes of the indices larger than them have very low intensities.
Definition: FLASHDeconvHelperStructs.h:73
PrecalculatedAveragine(const double min_mass, const double max_mass, const double delta, CoarseIsotopePatternGenerator *generator, const bool use_RNA_averagine)
constructor with parameters such as mass ranges and bin size.
Definition: IsotopeDistribution.h:65
A container type that gathers peaks similar in m/z and moving along retention time.
Definition: MassTrace.h:62
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
A more convenient string class.
Definition: String.h:60
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
FLASHIda C++ to C# (or vice versa) bridge functions The functions here are called in C# to invoke fun...
Definition: FeatureDeconvolution.h:48
struct for TopPIC identification (both PrSMs and proteoforms)
Definition: FLASHDeconvHelperStructs.h:133
double intensity
Definition: FLASHDeconvHelperStructs.h:165
int matched_peaks
Definition: FLASHDeconvHelperStructs.h:160
int first_residue
Definition: FLASHDeconvHelperStructs.h:157
double spec_q_value
Definition: FLASHDeconvHelperStructs.h:163
double adj_precursor_mass
Definition: FLASHDeconvHelperStructs.h:154
int matched_frags
Definition: FLASHDeconvHelperStructs.h:161
String str
the line string
Definition: FLASHDeconvHelperStructs.h:145
int scan
Definition: FLASHDeconvHelperStructs.h:149
int last_residue
Definition: FLASHDeconvHelperStructs.h:158
std::vector< double > unexp_mod
Definition: FLASHDeconvHelperStructs.h:159
double proteofrom_q_value
Definition: FLASHDeconvHelperStructs.h:164
bool operator>(const TopPicItem &a) const
int prsm_id
information from each column
Definition: FLASHDeconvHelperStructs.h:147
double e_value
Definition: FLASHDeconvHelperStructs.h:162
double precursor_mass
Definition: FLASHDeconvHelperStructs.h:153
int peak_count
Definition: FLASHDeconvHelperStructs.h:151
bool operator==(const TopPicItem &other) const
bool operator<(const TopPicItem &a) const
scan numbers are compared
int spec_id
Definition: FLASHDeconvHelperStructs.h:148
double rt
Definition: FLASHDeconvHelperStructs.h:150
int charge
Definition: FLASHDeconvHelperStructs.h:152
Wrapper struct for all the structs needed by the FLASHDeconv Three structures are defined: Precalcula...
Definition: FLASHDeconvHelperStructs.h:57
double avg_mass
Definition: FLASHDeconvHelperStructs.h:184
std::vector< float > per_charge_intensity
Definition: FLASHDeconvHelperStructs.h:180
int iso_offset
Definition: FLASHDeconvHelperStructs.h:182
std::vector< float > per_isotope_intensity
Definition: FLASHDeconvHelperStructs.h:181
static double getLogMz(const double mz, const bool positive)
calculate log mzs from mzs
double rep_mz
Definition: FLASHDeconvHelperStructs.h:187
MassTrace mt
Definition: FLASHDeconvHelperStructs.h:179
int charge_count
Definition: FLASHDeconvHelperStructs.h:185
double isotope_score
Definition: FLASHDeconvHelperStructs.h:186
static double getChargeMass(const bool positive)
get charge carrier mass
int rep_charge
Definition: FLASHDeconvHelperStructs.h:183
Definition: FLASHDeconvHelperStructs.h:177