OpenMS  3.0.0
PeakPickerHiRes.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 // $Author: Erhan Kenar $
32 // $Maintainer: Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
38 
41 
42 #define DEBUG_PEAK_PICKING
43 #undef DEBUG_PEAK_PICKING
44 //#undef DEBUG_DECONV
45 namespace OpenMS
46 {
47  class MSChromatogram;
48  class OnDiscMSExperiment;
49 
81  class OPENMS_DLLAPI PeakPickerHiRes :
82  public DefaultParamHandler,
83  public ProgressLogger
84  {
85 public:
88 
90  ~PeakPickerHiRes() override;
91 
93  struct PeakBoundary
94  {
95  double mz_min;
96  double mz_max;
97  };
98 
107  void pick(const MSSpectrum& input, MSSpectrum& output) const;
108 
116  void pick(const MSChromatogram& input, MSChromatogram& output) const;
117 
128  void pick(const MSSpectrum& input, MSSpectrum& output, std::vector<PeakBoundary>& boundaries, bool check_spacings = true) const;
129 
138  void pick(const MSChromatogram& input, MSChromatogram& output, std::vector<PeakBoundary>& boundaries, bool check_spacings = false) const;
139 
149  void pickExperiment(const PeakMap& input, PeakMap& output, const bool check_spectrum_type = true) const;
150 
162  void pickExperiment(const PeakMap& input,
163  PeakMap& output,
164  std::vector<std::vector<PeakBoundary> >& boundaries_spec,
165  std::vector<std::vector<PeakBoundary> >& boundaries_chrom,
166  const bool check_spectrum_type = true) const;
167 
175  void pickExperiment(/* const */ OnDiscMSExperiment& input, PeakMap& output, const bool check_spectrum_type = true) const;
176 
177 protected:
178 
179  template <typename ContainerType>
180  void pick_(const ContainerType& input, ContainerType& output, std::vector<PeakBoundary>& boundaries, bool check_spacings = true, int im_index = -1) const;
181 
182  // signal-to-noise parameter
184 
185  // maximal spacing difference defining a large gap
187 
188  // maximal spacing difference defining a missing data point
190 
191  // maximum number of missing points
192  unsigned missing_;
193 
194  // MS levels to which peak picking is applied
195  std::vector<Int> ms_levels_;
196 
199 
202 
203  // docu in base class
204  void updateMembers_() override;
205 
206  }; // end PeakPickerHiRes
207 
208 } // namespace OpenMS
209 
OpenMS::MSDataWritingConsumer
Consumer class that writes MS data to disk using the mzML format.
Definition: MSDataWritingConsumer.h:88
LogStream.h
DefaultParamHandler.h
OpenMS::MSSpectrum::getType
SpectrumSettings::SpectrumType getType(const bool query_data) const
Determine if spectrum is profile or centroided using up to three layers of information.
OpenMS::SpectrumSettings::CENTROID
centroid data or stick data
Definition: SpectrumSettings.h:73
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:147
OpenMS::PeakPickerHiRes::PeakBoundary::mz_max
double mz_max
Definition: PeakPickerHiRes.h:96
OpenMS::PeakPickerHiRes::spacing_difference_gap_
double spacing_difference_gap_
Definition: PeakPickerHiRes.h:186
Size
OpenMS::MzMLFile::store
void store(const String &filename, const PeakMap &map) const
Stores a map in an MzML file.
OpenMS::MSChromatogram::isSorted
bool isSorted() const
Checks if all peaks are sorted with respect to ascending RT.
OpenMS::MzMLFile
File adapter for MzML files.
Definition: MzMLFile.h:57
OpenMS::String
A more convenient string class.
Definition: String.h:58
MzMLFile.h
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
OpenMS::PeakPickerHiRes::pickExperiment
void pickExperiment(const PeakMap &input, PeakMap &output, const bool check_spectrum_type=true) const
Applies the peak-picking algorithm to a map (MSExperiment). This method picks peaks for each scan in ...
OpenMS::Constants::c
const double c
Definition: Constants.h:209
OpenMS::ListUtils::contains
static bool contains(const std::vector< T > &container, const E &elem)
Checks whether the element elem is contained in the given container.
Definition: ListUtils.h:162
OpenMS::PeakPickerHiRes::PeakBoundary
structure for peak boundaries
Definition: PeakPickerHiRes.h:93
OpenMS::PeakPickerHiRes::report_FWHM_
bool report_FWHM_
add floatDataArray 'FWHM'/'FWHM_ppm' to spectra with peak FWHM
Definition: PeakPickerHiRes.h:198
OPENMS_LOG_WARN
#define OPENMS_LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged.
Definition: LogStream.h:460
OpenMS::MSExperiment::size
Size size() const
Definition: MSExperiment.h:120
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS::MSSpectrum::getMSLevel
UInt getMSLevel() const
Returns the MS level.
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::PeakPickerHiRes
This class implements a fast peak-picking algorithm best suited for high resolution MS data (FT-ICR-M...
Definition: PeakPickerHiRes.h:81
OpenMS::PeakPickerHiRes::report_FWHM_as_ppm_
bool report_FWHM_as_ppm_
unit of 'FWHM' float data array (can be absolute or ppm).
Definition: PeakPickerHiRes.h:201
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
OpenMS::MSExperiment::getChromatograms
const std::vector< MSChromatogram > & getChromatograms() const
returns the chromatogram list
ProgressLogger.h
OpenMS::MzMLFile::load
void load(const String &filename, PeakMap &map)
Loads a map from a MzML file. Spectra and chromatograms are sorted by default (this can be disabled u...
OpenMS::OnDiscMSExperiment
Representation of a mass spectrometry experiment on disk.
Definition: OnDiscMSExperiment.h:66
OpenMS::DataProcessing::PEAK_PICKING
Peak picking (conversion from raw to peak data)
Definition: DataProcessing.h:67
OpenMS::PeakPickerHiRes::PeakBoundary::mz_min
double mz_min
Definition: PeakPickerHiRes.h:95
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::DefaultParamHandler::getDefaults
const Param & getDefaults() const
Non-mutable access to the default parameters.
OpenMS::PeakPickerHiRes::signal_to_noise_
double signal_to_noise_
Definition: PeakPickerHiRes.h:183
OpenMS::MSExperiment::empty
bool empty() const
Definition: MSExperiment.h:130
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:71
OpenMS::PeakPickerHiRes::missing_
unsigned missing_
Definition: PeakPickerHiRes.h:192
MSExperiment.h
OpenMS::Param::copy
Param copy(const std::string &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
OpenMS::MSExperiment::getChromatogram
MSChromatogram & getChromatogram(Size id)
returns a single chromatogram
OpenMS::PeakPickerHiRes::ms_levels_
std::vector< Int > ms_levels_
Definition: PeakPickerHiRes.h:195
OpenMS::MzMLFile::transform
void transform(const String &filename_in, Interfaces::IMSDataConsumer *consumer, bool skip_full_count=false, bool skip_first_pass=false)
Transforms a map while loading using the supplied MSDataConsumer.
OpenMS::MSChromatogram
The representation of a chromatogram.
Definition: MSChromatogram.h:53
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
PeakPickerHiRes.h
MSDataWritingConsumer.h
OpenMS::MSSpectrum
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
OpenMS::PeakPickerHiRes::spacing_difference_
double spacing_difference_
Definition: PeakPickerHiRes.h:189
OpenMS::ProgressLogger::setLogType
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
TOPPBase.h