OpenMS  3.0.0
DeconvolvedSpectrum.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 
40 
41 #include <iomanip>
42 
43 namespace OpenMS
44 {
45  class PeakGroup;
46 
56  class OPENMS_DLLAPI DeconvolvedSpectrum
57  {
58  public:
60 
62  DeconvolvedSpectrum() = default;
63 
68  explicit DeconvolvedSpectrum(int scan_number);
69 
71  ~DeconvolvedSpectrum() = default;
72 
74  DeconvolvedSpectrum(const DeconvolvedSpectrum& ) = default;
75 
77  DeconvolvedSpectrum(DeconvolvedSpectrum&& other) noexcept = default;
78 
80  DeconvolvedSpectrum& operator=(const DeconvolvedSpectrum& deconvolved_spectrum) = default;
81 
82 
87  MSSpectrum toSpectrum(int to_charge, double tol = 10.0, bool retain_undeconvolved = false);
88 
90  const MSSpectrum& getOriginalSpectrum() const;
91 
93  const PeakGroup& getPrecursorPeakGroup() const;
94 
96  int getPrecursorCharge() const;
97 
99  const Precursor& getPrecursor() const;
100 
104  double getCurrentMaxMass(double max_mass) const;
105 
109  double getCurrentMinMass(double min_mass) const;
110 
114  int getCurrentMaxAbsCharge(int max_abs_charge) const;
115 
117  int getScanNumber() const;
118 
120  int getPrecursorScanNumber() const;
121 
123  const Precursor::ActivationMethod& getActivationMethod() const;
124 
126  void setPrecursor(const Precursor& precursor);
127 
129  void setPrecursorIntensity(float i);
130 
132  void setPrecursorScanNumber(int scan_number);
133 
135  void setActivationMethod(const Precursor::ActivationMethod& method);
136 
138  void setPrecursorPeakGroup(const PeakGroup& pg);
139 
141  void setOriginalSpectrum(const MSSpectrum& spec);
142 
146  void static updatePeakGroupQvalues(std::vector<DeconvolvedSpectrum>& deconvolved_spectra, std::vector<DeconvolvedSpectrum>& deconvolved_decoy_spectra);
147 
149  void setPeakGroups (std::vector<PeakGroup>& x);
150 
152  std::vector<PeakGroup>::const_iterator begin() const noexcept;
153  std::vector<PeakGroup>::const_iterator end() const noexcept;
154 
155  std::vector<PeakGroup>::iterator begin() noexcept;
156  std::vector<PeakGroup>::iterator end() noexcept;
157 
158  const PeakGroup& operator[](Size i) const;
159  PeakGroup& operator[](Size i);
160  void push_back (const PeakGroup& pg);
161  Size size() const noexcept;
162  void clear();
163  void reserve (Size n);
164  bool empty() const;
165 
167  void sort();
169  void sortByQScore();
170  private:
172  std::vector<PeakGroup> peak_groups_;
174  MSSpectrum spec_;
176  PeakGroup precursor_peak_group_;
178  Precursor precursor_peak_;
180  Precursor::ActivationMethod activation_method_;
182  int scan_number_ = 0, precursor_scan_number_ = 0;
183 
184  };
185 }
Precursor meta information.
Definition: Precursor.h:58
FLASHDeconvHelperStructs::LogMzPeak LogMzPeak
Definition: DeconvolvedSpectrum.h:59
log transformed peak. After deconvolution, all necessary information from deconvolution such as charg...
Definition: FLASHDeconvHelperStructs.h:164
STL namespace.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
Class describing a deconvolved mass. A mass contains multiple (LogMz) peaks of different charges and ...
Definition: PeakGroup.h:51
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
ActivationMethod
Method of activation.
Definition: Precursor.h:84
A class representing a deconvolved spectrum. DeconvolvedSpectrum consists of PeakGroups representing ...
Definition: DeconvolvedSpectrum.h:56