OpenMS
Loading...
Searching...
No Matches
EntrapmentEvaluation.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: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11#include <OpenMS/config.h>
15
16#include <map>
17#include <string>
18#include <unordered_map>
19#include <unordered_set>
20#include <vector>
21
22namespace OpenMS
23{
24 class PeptideHit;
25
61 class OPENMS_DLLAPI EntrapmentEvaluation
62 {
63 public:
65 enum class Kind
66 {
67 TARGET,
68 ENTRAPMENT,
69 DECOY
70 };
71
73 enum class Level
74 {
75 PSM,
76 PEPTIDE
77 };
78
80 struct OPENMS_DLLAPI Result
81 {
82 Size accepted = 0;
83 Size entrapment = 0;
84 Size entrapment_target_not_accepted = 0;
85 Size entrapment_above_target = 0;
86 bool paired = false;
87 double te_ratio = 1.0;
88
90 double lowerBoundFDP() const;
92 double combinedFDP() const;
94 double pairedFDP() const;
95 };
96
98 using PeptidePairs = std::unordered_map<std::string, std::string>;
99
113 static Kind classify(const PeptideHit& hit, const std::string& entrapment_prefix,
114 const std::string& decoy_string = "", bool decoy_is_prefix = true);
115
126 static double estimateTERatio(const std::vector<FASTAFile::FASTAEntry>& db,
127 const std::string& entrapment_prefix,
128 const std::string& decoy_string,
129 bool decoy_is_prefix,
130 const std::string& enzyme = "Trypsin",
131 Size missed_cleavages = 2,
132 Size min_length = 7,
133 Size max_length = 40);
134
140 static std::unordered_set<std::string> targetPeptides(const std::vector<FASTAFile::FASTAEntry>& db,
141 const std::string& entrapment_prefix,
142 const std::string& decoy_string,
143 bool decoy_is_prefix,
144 const std::string& enzyme = "Trypsin",
145 Size missed_cleavages = 2,
146 Size min_length = 7,
147 Size max_length = 40);
148
157 static double qValue(const PeptideIdentification& pep_id, const PeptideHit& hit);
158
173 static PeptidePairs pairPeptides(const std::vector<FASTAFile::FASTAEntry>& db,
174 const std::string& entrapment_prefix,
175 const std::string& decoy_string,
176 bool decoy_is_prefix,
177 const std::string& enzyme = "Trypsin",
178 Size missed_cleavages = 2,
179 Size min_length = 7,
180 Size max_length = 40,
181 Size* mismatched = nullptr);
182
205 static std::map<std::string, Result> evaluate(const PeptideIdentificationList& pep_ids,
206 double q_threshold,
207 const std::string& entrapment_prefix,
208 double te_ratio,
209 Level level = Level::PSM,
210 const std::string& class_meta_value = "",
211 const std::unordered_set<std::string>* target_peptides = nullptr,
212 const PeptidePairs* pairs = nullptr,
213 const std::string& score_meta_value = "",
214 const std::string& decoy_string = "",
215 bool decoy_is_prefix = true);
216 };
217} // namespace OpenMS
Measures the false discovery proportion (FDP) of identifications with an entrapment database.
Definition EntrapmentEvaluation.h:62
static std::map< std::string, Result > evaluate(const PeptideIdentificationList &pep_ids, double q_threshold, const std::string &entrapment_prefix, double te_ratio, Level level=Level::PSM, const std::string &class_meta_value="", const std::unordered_set< std::string > *target_peptides=nullptr, const PeptidePairs *pairs=nullptr, const std::string &score_meta_value="", const std::string &decoy_string="", bool decoy_is_prefix=true)
Evaluate the identifications at a q-value threshold.
static double estimateTERatio(const std::vector< FASTAFile::FASTAEntry > &db, const std::string &entrapment_prefix, const std::string &decoy_string, bool decoy_is_prefix, const std::string &enzyme="Trypsin", Size missed_cleavages=2, Size min_length=7, Size max_length=40)
Estimate T/E, the ratio of distinct searchable target to entrapment peptides, from a database.
Level
what is counted as one discovery
Definition EntrapmentEvaluation.h:74
static Kind classify(const PeptideHit &hit, const std::string &entrapment_prefix, const std::string &decoy_string="", bool decoy_is_prefix=true)
Classify a peptide hit by its protein accessions.
static double qValue(const PeptideIdentification &pep_id, const PeptideHit &hit)
Return the q-value of a hit.
std::unordered_map< std::string, std::string > PeptidePairs
entrapment peptide -> the target peptide it was made from (both unmodified, I replaced by L)
Definition EntrapmentEvaluation.h:98
static std::unordered_set< std::string > targetPeptides(const std::vector< FASTAFile::FASTAEntry > &db, const std::string &entrapment_prefix, const std::string &decoy_string, bool decoy_is_prefix, const std::string &enzyme="Trypsin", Size missed_cleavages=2, Size min_length=7, Size max_length=40)
The distinct searchable peptides of the target proteins of a database, with every I replaced by L.
Kind
how a PSM is counted
Definition EntrapmentEvaluation.h:66
static PeptidePairs pairPeptides(const std::vector< FASTAFile::FASTAEntry > &db, const std::string &entrapment_prefix, const std::string &decoy_string, bool decoy_is_prefix, const std::string &enzyme="Trypsin", Size missed_cleavages=2, Size min_length=7, Size max_length=40, Size *mismatched=nullptr)
Pair every entrapment peptide with the target peptide it was made from.
Represents a single spectrum match (candidate) for a specific tandem mass spectrum (MS/MS).
Definition PeptideHit.h:52
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:66
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
result for one class at one q-value threshold and level
Definition EntrapmentEvaluation.h:81
double lowerBoundFDP() const
lower bound N_E / N (0 if nothing accepted)
double combinedFDP() const
combined estimate N_E * (1 + T/E) / N (0 if nothing accepted)
double pairedFDP() const
paired estimate (N_E + N_{E>=s>T} + 2 * N_{E>T>=s}) / N (0 if nothing accepted, NaN if not available)