OpenMS
Loading...
Searching...
No Matches
Ms2IdentificationRate.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
11#include <OpenMS/QC/QCBase.h>
12
15#include <string>
16#include <vector>
17
18namespace OpenMS
19{
20 class FeatureMap;
21 class MSExperiment;
22 class MzTabMetaData;
23 class PeptideIdentification;
24
32 class OPENMS_DLLAPI Ms2IdentificationRate : public QCBase
33 {
34 public:
37 Size num_peptide_identification = 0;
38 Size num_ms2_spectra = 0;
39 double identification_rate = 0.;
40 };
41
42 private:
44 const String name_ = "Ms2IdentificationRate";
45
47 std::vector<IdentificationRateData> rate_result_;
48
51
52 /*
53 * @brief Checks pepID for target/decoy
54 *
55 * Only checks the first (!) hit, all other hits are ignored
56 * Is static so that it can be used with MapUtilities::applyFunctionOnPeptideIDs() without creating a new object for each ID
57 *
58 * @param[in] id pepID to be checked
59 * @param[in] all_targets always returns true (if the hits aren't empty)
60 * @return true/false
61 * @throws MissingInformation if target/decoy annotation is missing
62 */
63 static bool isTargetPeptide_(const PeptideIdentification& id, bool all_targets);
64
65 /*
66 * @brief Calculates id-rate and writes the result into a IdentificationRateData object which is appended to rate_result_
67 *
68 * @param[in] ms2_spectra_count number of found ms2 spectra
69 * @param[in] pep_ids_count number of found (target) peptide identifications
70 */
71 void writeResults_(Size pep_ids_count, Size ms2_spectra_count);
72
73 public:
76
78 virtual ~Ms2IdentificationRate() = default;
79
93 void compute(const FeatureMap& feature_map, const MSExperiment& exp, bool assume_all_target = false);
94
108 void compute(const PeptideIdentificationList& pep_ids, const MSExperiment& exp, bool assume_all_target = false);
109
111 const String& getName() const override;
112
114 const std::vector<IdentificationRateData>& getResults() const;
115
120 QCBase::Status requirements() const override;
121
123 };
124
125} // 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
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
This class is a metric for the QualityControl-ToppTool.
Definition Ms2IdentificationRate.h:33
const String & getName() const override
returns the name of the metric
Ms2IdentificationRate()=default
Default constructor.
std::vector< IdentificationRateData > rate_result_
container that stores results
Definition Ms2IdentificationRate.h:47
void compute(const FeatureMap &feature_map, const MSExperiment &exp, bool assume_all_target=false)
computes Ms2 Identification Rate with FeatureMap
void addMetaDataMetricsToMzTab(MzTabMetaData &meta) const
const std::vector< IdentificationRateData > & getResults() const
returns results
QCBase::Status requirements() const override
Returns the input data requirements of the compute(...) function.
void writeResults_(Size pep_ids_count, Size ms2_spectra_count)
virtual ~Ms2IdentificationRate()=default
Destructor.
void compute(const PeptideIdentificationList &pep_ids, const MSExperiment &exp, bool assume_all_target=false)
computes Ms2 Identification Rate with PeptideIdentifications
static bool isTargetPeptide_(const PeptideIdentification &id, bool all_targets)
Size getMS2Count_(const MSExperiment &exp)
returns number of all ms2 spectra in an MSExperiment
Structure for storing results.
Definition Ms2IdentificationRate.h:36
all meta data of a mzTab file. Please refer to specification for documentation.
Definition MzTab.h:118
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:64
This class serves as an abstract base class for all QC classes.
Definition QCBase.h:29
A more convenient string class.
Definition String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19