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 #include <iomanip>
41 
42 namespace OpenMS
43 {
44  class PeakGroup;
45 
55  class OPENMS_DLLAPI DeconvolvedSpectrum
56  {
57  public:
59 
61  DeconvolvedSpectrum() = default;
62 
68  DeconvolvedSpectrum(const MSSpectrum& spectrum, const int scan_number);
69 
71  ~DeconvolvedSpectrum() = default;
72 
75 
78 
80  DeconvolvedSpectrum& operator=(const DeconvolvedSpectrum& deconvolved_spectrum) = default;
81 
82 
86  MSSpectrum toSpectrum(const int to_charge, bool retain_undeconvolved = false);
87 
90 
93 
95  int getPrecursorCharge() const;
96 
98  const Precursor& getPrecursor() const;
99 
101  void setPrecursorPeakGroupQvalue(const double qvalue_with_iso_decoy_only , const double qvalue_with_noise_decoy_only, const double qvalue_with_charge_decoy_only);
102 
106  double getCurrentMaxMass(const double max_mass) const;
107 
111  double getCurrentMinMass(const double min_mass) const;
112 
116  int getCurrentMaxAbsCharge(const int max_abs_charge) const;
117 
119  int getScanNumber() const;
120 
123 
125  const String& getActivationMethod() const;
126 
128  void setPrecursor(const Precursor& precursor);
129 
131  void setPrecursorIntensity(const double i);
132 
134  void setPrecursorScanNumber(const int scan_number);
135 
137  void setActivationMethod(const String& method);
138 
141 
142  void static updatePeakGroupQvalues(std::vector<DeconvolvedSpectrum>& deconvolved_spectra, std::vector<DeconvolvedSpectrum>& deconvolved_decoy_spectra);
143 
144 
145  std::vector<PeakGroup>::const_iterator begin() const noexcept;
146  std::vector<PeakGroup>::const_iterator end() const noexcept;
147 
148  std::vector<PeakGroup>::iterator begin() noexcept;
149  std::vector<PeakGroup>::iterator end() noexcept;
150 
151 
152  const PeakGroup& operator[](Size i) const;
153  void push_back (const PeakGroup& pg);
154  Size size() const noexcept;
155  void clear();
156  void reserve (Size n);
157  bool empty() const;
158  void swap (std::vector<PeakGroup>& x);
159 
160  void sort();
161  void sortByQScore();
162  private:
164  std::vector<PeakGroup> peak_groups;
166  MSSpectrum spec_;
168  PeakGroup precursor_peak_group_;
170  Precursor precursor_peak_;
172  String activation_method_;
174  int scan_number_ = 0, precursor_scan_number_ = 0;
175 
176  };
177 }
A class representing a deconvolved spectrum. DeconvolvedSpectrum consists of PeakGroups representing ...
Definition: DeconvolvedSpectrum.h:56
void setActivationMethod(const String &method)
set activation method
void setPrecursor(const Precursor &precursor)
set max isotope index
double getCurrentMinMass(const double min_mass) const
const MSSpectrum & getOriginalSpectrum() const
original spectrum getter
std::vector< PeakGroup >::const_iterator begin() const noexcept
FLASHDeconvHelperStructs::LogMzPeak LogMzPeak
Definition: DeconvolvedSpectrum.h:58
int getPrecursorCharge() const
precursor charge getter (set in registerPrecursor)
~DeconvolvedSpectrum()=default
default destructor
MSSpectrum toSpectrum(const int to_charge, bool retain_undeconvolved=false)
const PeakGroup & getPrecursorPeakGroup() const
get precursor peak group for MSn (n>1) spectrum. It returns an empty peak group if no peak group is r...
double getCurrentMaxMass(const double max_mass) const
void setPrecursorPeakGroup(const PeakGroup &pg)
set precusor peakGroup
int getCurrentMaxAbsCharge(const int max_abs_charge) const
const String & getActivationMethod() const
get activation method
DeconvolvedSpectrum(const DeconvolvedSpectrum &)=default
copy constructor
int getScanNumber() const
get scan number of the original spectrum
DeconvolvedSpectrum()=default
default constructor
const Precursor & getPrecursor() const
get precursor peak
DeconvolvedSpectrum(DeconvolvedSpectrum &&other)=default
move constructor
DeconvolvedSpectrum(const MSSpectrum &spectrum, const int scan_number)
Constructor for DeconvolvedSpectrum. Takes the spectrum and scan number calculated from outside.
DeconvolvedSpectrum & operator=(const DeconvolvedSpectrum &deconvolved_spectrum)=default
assignment operator
void setPrecursorScanNumber(const int scan_number)
set max isotope index
void setPrecursorPeakGroupQvalue(const double qvalue_with_iso_decoy_only, const double qvalue_with_noise_decoy_only, const double qvalue_with_charge_decoy_only)
set qvalue of precursor peak
int getPrecursorScanNumber() const
get precursor scan number - only if it is registered. Otherwise return 0
void setPrecursorIntensity(const double i)
set precursor peak intensity
static void updatePeakGroupQvalues(std::vector< DeconvolvedSpectrum > &deconvolved_spectra, std::vector< DeconvolvedSpectrum > &deconvolved_decoy_spectra)
log transformed peak. After deconvolution, all necessary information from deconvolution such as charg...
Definition: FLASHDeconvHelperStructs.h:192
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
Class describing a deconvolved mass. A mass contains multiple peaks of different charges and isotope ...
Definition: PeakGroup.h:51
Precursor meta information.
Definition: Precursor.h:61
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