All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FragmentMassError.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow$
6 // $Authors: Patricia Scheil, Swenja Wagner$
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
12 #include <OpenMS/QC/QCBase.h>
14 #include <vector>
15 
16 namespace OpenMS
17 {
18  class FeatureMap;
19  class MSExperiment;
20  class PeptideIdentification;
21  class WindowMower;
22 
23  class OPENMS_DLLAPI FragmentMassError : public QCBase
24  {
25  public:
27  FragmentMassError() = default;
28 
30  virtual ~FragmentMassError() = default;
31 
35  struct Statistics {
36  double average_ppm = 0;
37  double variance_ppm = 0;
38  };
39 
62  void compute(FeatureMap& fmap, const MSExperiment& exp, const QCBase::SpectraMap& map_to_spectrum, ToleranceUnit tolerance_unit = ToleranceUnit::AUTO, double tolerance = 20);
63 
87  void compute(PeptideIdentificationList& pep_ids, const ProteinIdentification::SearchParameters& search_params, const MSExperiment& exp, const QCBase::SpectraMap& map_to_spectrum,
88  ToleranceUnit tolerance_unit = ToleranceUnit::AUTO, double tolerance = 20);
89 
91  const String& getName() const override;
92 
94  const std::vector<Statistics>& getResults() const;
95 
96 
101  QCBase::Status requirements() const override;
102 
103  private:
105  std::vector<Statistics> results_;
106 
107  static void calculateFME_(PeptideIdentification& pep_id, const MSExperiment& exp, const QCBase::SpectraMap& map_to_spectrum, bool& print_warning, double tolerance,
108  FragmentMassError::ToleranceUnit tolerance_unit, double& accumulator_ppm, UInt32& counter_ppm, WindowMower& window_mower_filter);
109 
110  static void calculateVariance_(FragmentMassError::Statistics& result, const PeptideIdentification& pep_id, const UInt num_ppm);
111  };
112 
113 } // namespace OpenMS
A container for features.
Definition: FeatureMap.h:82
Stores and handles combinations of enum values, e.g. a set of flags as bits flipped in an UInt64.
Definition: FlagSet.h:28
Definition: FragmentMassError.h:24
void compute(FeatureMap &fmap, const MSExperiment &exp, const QCBase::SpectraMap &map_to_spectrum, ToleranceUnit tolerance_unit=ToleranceUnit::AUTO, double tolerance=20)
computes FragmentMassError (FME) in ppm and Dalton (only of the first PeptideHit of each PepID)
const String & getName() const override
returns the name of the metric
static void calculateVariance_(FragmentMassError::Statistics &result, const PeptideIdentification &pep_id, const UInt num_ppm)
static void calculateFME_(PeptideIdentification &pep_id, const MSExperiment &exp, const QCBase::SpectraMap &map_to_spectrum, bool &print_warning, double tolerance, FragmentMassError::ToleranceUnit tolerance_unit, double &accumulator_ppm, UInt32 &counter_ppm, WindowMower &window_mower_filter)
QCBase::Status requirements() const override
Returns the input data requirements of the compute(...) function.
const std::vector< Statistics > & getResults() const
returns results
std::vector< Statistics > results_
container that stores results
Definition: FragmentMassError.h:105
FragmentMassError()=default
Default constructor.
virtual ~FragmentMassError()=default
Destructor.
void compute(PeptideIdentificationList &pep_ids, const ProteinIdentification::SearchParameters &search_params, const MSExperiment &exp, const QCBase::SpectraMap &map_to_spectrum, ToleranceUnit tolerance_unit=ToleranceUnit::AUTO, double tolerance=20)
computes FragmentMassError (FME) in ppm and Dalton (only of the first PeptideHit of each PepID)
Structure for storing results: average and variance of all FragmentMassErrors in ppm.
Definition: FragmentMassError.h:35
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:49
Container for peptide identifications from multiple spectra.
Definition: PeptideIdentificationList.h:66
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition: PeptideIdentification.h:63
Map to find a spectrum via its NativeID.
Definition: QCBase.h:63
This class serves as an abstract base class for all QC classes.
Definition: QCBase.h:29
ToleranceUnit
Definition: QCBase.h:49
A more convenient string class.
Definition: String.h:34
Retains the highest peaks in a sliding or jumping window.
Definition: WindowMower.h:30
uint32_t UInt32
Unsigned integer type (32bit)
Definition: Types.h:33
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Search parameters of the DB search.
Definition: ProteinIdentification.h:248