OpenMS
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-2023.
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 #include <iomanip>
41 
42 namespace OpenMS
43 {
44  class PeakGroup;
45 
55  class OPENMS_DLLAPI DeconvolvedSpectrum
56  {
57  public:
59 
61  DeconvolvedSpectrum() = default;
62 
67  explicit DeconvolvedSpectrum(int scan_number);
68 
70  ~DeconvolvedSpectrum() = default;
71 
74 
76  DeconvolvedSpectrum(DeconvolvedSpectrum&& other) noexcept = default;
77 
79  DeconvolvedSpectrum& operator=(const DeconvolvedSpectrum& deconvolved_spectrum) = default;
80 
81 
87  MSSpectrum toSpectrum(int to_charge, uint min_ms_level, double tol = 10.0, bool retain_undeconvolved = false);
88 
91 
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 
121 
124 
126  void setPrecursor(const Precursor& precursor);
127 
129  void setPrecursorIntensity(float i);
130 
132  void setPrecursorScanNumber(int scan_number);
133 
136 
139 
141  void setOriginalSpectrum(const MSSpectrum& spec);
142 
144  void setPeakGroups(std::vector<PeakGroup>& x);
145 
147  std::vector<PeakGroup>::const_iterator begin() const noexcept;
148  std::vector<PeakGroup>::const_iterator end() const noexcept;
149 
150  std::vector<PeakGroup>::iterator begin() noexcept;
151  std::vector<PeakGroup>::iterator end() noexcept;
152 
153  const PeakGroup& operator[](Size i) const;
154  PeakGroup& operator[](Size i);
155  void push_back(const PeakGroup& pg);
156  Size size() const noexcept;
157  void clear();
158  void reserve(Size n);
159  bool empty() const;
160 
162  void sort();
164  void sortByQscore();
165 
166  private:
168  std::vector<PeakGroup> peak_groups_;
170  MSSpectrum spec_;
172  PeakGroup precursor_peak_group_;
174  Precursor precursor_peak_;
176  Precursor::ActivationMethod activation_method_;
178  int scan_number_ = 0, precursor_scan_number_ = 0;
179  };
180 } // namespace OpenMS
A class representing a deconvolved spectrum. DeconvolvedSpectrum consists of PeakGroups representing ...
Definition: DeconvolvedSpectrum.h:56
void setPrecursor(const Precursor &precursor)
set precursor for MSn for n>1
void setOriginalSpectrum(const MSSpectrum &spec)
original spectrum setter
const MSSpectrum & getOriginalSpectrum() const
original spectrum getter
std::vector< PeakGroup >::const_iterator begin() const noexcept
iterators and vector operators for std::vector<PeakGroup> peak_groups_ in this spectrum
void setPrecursorIntensity(float i)
set precursor peak intensity
FLASHDeconvHelperStructs::LogMzPeak LogMzPeak
Definition: DeconvolvedSpectrum.h:58
void setPeakGroups(std::vector< PeakGroup > &x)
set peak groups in this spectrum
DeconvolvedSpectrum(int scan_number)
Constructor for DeconvolvedSpectrum. Takes the spectrum and scan number calculated from outside.
int getPrecursorCharge() const
precursor charge getter (set in registerPrecursor)
~DeconvolvedSpectrum()=default
default destructor
int getCurrentMaxAbsCharge(int max_abs_charge) const
DeconvolvedSpectrum(DeconvolvedSpectrum &&other) noexcept=default
move constructor
double getCurrentMinMass(double min_mass) const
double getCurrentMaxMass(double max_mass) const
void setPrecursorPeakGroup(const PeakGroup &pg)
set precursor peakGroup
DeconvolvedSpectrum(const DeconvolvedSpectrum &)=default
copy constructor
void setPrecursorScanNumber(int scan_number)
set precursor scan number
MSSpectrum toSpectrum(int to_charge, uint min_ms_level, double tol=10.0, bool retain_undeconvolved=false)
int getScanNumber() const
get scan number of the original spectrum
PeakGroup & getPrecursorPeakGroup()
get precursor peak group for MSn (n>1) spectrum. It returns an empty peak group if no peak group is r...
const Precursor::ActivationMethod & getActivationMethod() const
get activation method
DeconvolvedSpectrum()=default
default constructor
const Precursor & getPrecursor() const
get precursor peak
void setActivationMethod(const Precursor::ActivationMethod &method)
set activation method
DeconvolvedSpectrum & operator=(const DeconvolvedSpectrum &deconvolved_spectrum)=default
assignment operator
int getPrecursorScanNumber() const
get precursor scan number - only if it is registered. Otherwise return 0
log transformed peak. After deconvolution, all necessary information from deconvolution such as charg...
Definition: FLASHDeconvHelperStructs.h:165
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
Class describing a deconvolved mass. A mass contains multiple (LogMz) peaks of different charges and ...
Definition: PeakGroup.h:52
Precursor meta information.
Definition: Precursor.h:61
ActivationMethod
Method of activation.
Definition: Precursor.h:85
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48