OpenMS
Loading...
Searching...
No Matches
XFDRAlgorithm.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: Eugen Netz $
6// $Authors: Lukas Zimmermann, Eugen Netz $
7// --------------------------------------------------------------------------
8
9#pragma once
10
19#include <cassert>
20
21namespace OpenMS
22{
23
24 //-------------------------------------------------------------
25 // Doxygen docu
26 //-------------------------------------------------------------
27
39 class OPENMS_DLLAPI XFDRAlgorithm :
41 {
42
43 public:
44
46 enum class ExitCodes
47 {
48 EXECUTION_OK,
49 ILLEGAL_PARAMETERS,
50 UNEXPECTED_RESULT
51 };
52
55
57 ~XFDRAlgorithm() override;
58
67
73
74private:
75 void updateMembers_() override;
76
87
93 static void assignTypes_(PeptideHit& pep_id, StringList& types);
94
106 void fdr_xprophet_(std::map< std::string, Math::Histogram<> >& cum_histograms,
107 const std::string& targetclass, const std::string& decoyclass, const std::string& fulldecoyclass,
108 std::vector< double >& fdr, bool mono) const;
109
115 static void calc_qfdr_(const std::vector< double >& fdr, std::vector< double >& qfdr);
116
118
119 void writeArgumentsLog_() const;
120
121 std::string getId_(const PeptideHit& ph) const;
122
124 {
125 Size alpha_ions = Size(ph.getMetaValue("matched_linear_alpha")) + Size(ph.getMetaValue("matched_xlink_alpha"));
126 Size beta_ions = Size(ph.getMetaValue("matched_linear_beta")) + Size(ph.getMetaValue("matched_xlink_beta"));
127 return std::min(alpha_ions, beta_ions);
128 }
129
130 inline static void setIntraProtein_(PeptideHit& ph, const bool value)
131 {
132 ph.setMetaValue("XFDR:is_intraprotein", DataValue(value ? "true" : "false"));
133 }
134
135 inline static void setInterProtein_(PeptideHit& ph, const bool value)
136 {
137 ph.setMetaValue("XFDR:is_interprotein", DataValue(value ? "true" : "false"));
138 }
139
143 static bool isSameProtein_(
144 std::string prot1,
145 std::string prot2,
146 const std::string &decoy_string)
147 {
148 StringUtils::substitute(prot1, decoy_string, "");
149 StringUtils::substitute(prot2, decoy_string, "");
150 assert( ! StringUtils::hasSubstring(prot1, decoy_string));
151 assert( ! StringUtils::hasSubstring(prot2, decoy_string));
152 return prot1 == prot2;
153 }
154
155 // Score range for this of the tool
158
159 // unique top hits
160 std::vector<std::string> unique_ids_;
161 std::vector<double> unique_id_scores_;
162
163 // maps index of peptide id all_pep_ids_ to vector of cross link class
164 std::map<std::string, std::vector<std::string>> cross_link_classes_;
165
166 // Program arguments
167 std::string decoy_string_;
176
177 // Names of the class parameters
178 static const std::string param_decoy_string_;
179 static const std::string param_minborder_;
180 static const std::string param_maxborder_;
181 static const std::string param_mindeltas_;
182 static const std::string param_minionsmatched_;
183 static const std::string param_uniquexl_;
184 static const std::string param_no_qvalues_;
185 static const std::string param_minscore_;
186 static const std::string param_binsize_;
187
188 // Constants related to particular crosslink classes
189 static const std::string crosslink_class_intradecoys_;
191 static const std::string crosslink_class_interdecoys_;
193 static const std::string crosslink_class_monodecoys_;
194 static const std::string crosslink_class_intralinks_;
195 static const std::string crosslink_class_interlinks_;
196 static const std::string crosslink_class_monolinks_;
197 static const std::string crosslink_class_decoys_;
198 static const std::string crosslink_class_targets_;
201 };
202}
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition DataValue.h:33
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
Representation of a histogram.
Definition Histogram.h:38
const DataValue & getMetaValue(const std::string &name) const
Returns the value corresponding to a string, or DataValue::EMPTY if not found.
void setMetaValue(const std::string &name, const DataValue &value)
Sets the DataValue corresponding to a name.
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
Base class for all classes that want to report their progress.
Definition ProgressLogger.h:28
Representation of a protein identification run.
Definition ProteinIdentification.h:55
Calculates false discovery rate estimates on crosslink identifications.
Definition XFDRAlgorithm.h:41
static const std::string crosslink_class_targets_
Definition XFDRAlgorithm.h:198
ExitCodes validateClassArguments() const
Checks whether the parameters of the object are valid.
bool arg_no_qvalues_
Definition XFDRAlgorithm.h:174
static const std::string param_mindeltas_
Definition XFDRAlgorithm.h:181
static const std::string crosslink_class_hybriddecoysintralinks_
Definition XFDRAlgorithm.h:199
static const std::string param_maxborder_
Definition XFDRAlgorithm.h:180
std::string getId_(const PeptideHit &ph) const
static void setIntraProtein_(PeptideHit &ph, const bool value)
Definition XFDRAlgorithm.h:130
static const std::string crosslink_class_hybriddecoysinterlinks_
Definition XFDRAlgorithm.h:200
static const std::string crosslink_class_interdecoys_
Definition XFDRAlgorithm.h:191
static void calc_qfdr_(const std::vector< double > &fdr, std::vector< double > &qfdr)
Calculates the qFDR values for the provided FDR values, assuming that the FDRs are sorted by score in...
static const std::string crosslink_class_decoys_
Definition XFDRAlgorithm.h:197
static const std::string crosslink_class_fulldecoysinterlinks_
Definition XFDRAlgorithm.h:192
static const std::string crosslink_class_fulldecoysintralinks_
Definition XFDRAlgorithm.h:190
void findTopUniqueHits_(PeptideIdentificationList &peptide_ids)
ExitCodes run(PeptideIdentificationList &peptide_ids, ProteinIdentification &protein_id)
Performs the main function of this class, the FDR estimation for cross-linked peptide experiments.
static const std::string param_minborder_
Definition XFDRAlgorithm.h:179
bool arg_uniquex_
Definition XFDRAlgorithm.h:173
double arg_minscore_
Definition XFDRAlgorithm.h:172
static const std::string crosslink_class_monolinks_
Definition XFDRAlgorithm.h:196
XFDRAlgorithm()
Default constructor.
static const std::string crosslink_class_intradecoys_
Definition XFDRAlgorithm.h:189
static const std::string crosslink_class_monodecoys_
Definition XFDRAlgorithm.h:193
static const std::string crosslink_class_intralinks_
Definition XFDRAlgorithm.h:194
double arg_mindeltas_
Definition XFDRAlgorithm.h:168
static const std::string crosslink_class_interlinks_
Definition XFDRAlgorithm.h:195
static const std::string param_uniquexl_
Definition XFDRAlgorithm.h:183
void initDataStructures_(PeptideIdentificationList &peptide_ids, ProteinIdentification &protein_id)
Prepares vector of PeptideIdentification such that it can be processed downstream....
static const std::string param_minionsmatched_
Definition XFDRAlgorithm.h:182
static const std::string param_binsize_
Definition XFDRAlgorithm.h:186
Int min_score_
Definition XFDRAlgorithm.h:156
std::vector< double > unique_id_scores_
Definition XFDRAlgorithm.h:161
void writeArgumentsLog_() const
static bool isSameProtein_(std::string prot1, std::string prot2, const std::string &decoy_string)
Determines whether the Peptide Evidences belong to the same protein, modulo decoy.
Definition XFDRAlgorithm.h:143
static Size getMinIonsMatched_(const PeptideHit &ph)
Definition XFDRAlgorithm.h:123
Int max_score_
Definition XFDRAlgorithm.h:157
static const std::string param_decoy_string_
Definition XFDRAlgorithm.h:178
static const std::string param_minscore_
Definition XFDRAlgorithm.h:185
static void setInterProtein_(PeptideHit &ph, const bool value)
Definition XFDRAlgorithm.h:135
void fdr_xprophet_(std::map< std::string, Math::Histogram<> > &cum_histograms, const std::string &targetclass, const std::string &decoyclass, const std::string &fulldecoyclass, std::vector< double > &fdr, bool mono) const
xprophet method for target hits counting as implemented in xProphet
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
std::vector< std::string > unique_ids_
Definition XFDRAlgorithm.h:160
ExitCodes
Exit codes.
Definition XFDRAlgorithm.h:47
static void assignTypes_(PeptideHit &pep_id, StringList &types)
Inspects a PeptideIdentification and assigns all cross-link types that this identification belongs to...
std::map< std::string, std::vector< std::string > > cross_link_classes_
Definition XFDRAlgorithm.h:164
double arg_minborder_
Definition XFDRAlgorithm.h:169
double arg_maxborder_
Definition XFDRAlgorithm.h:170
Int arg_minionsmatched_
Definition XFDRAlgorithm.h:171
std::string decoy_string_
Definition XFDRAlgorithm.h:167
double arg_binsize_
Definition XFDRAlgorithm.h:175
~XFDRAlgorithm() override
Default destructor.
static const std::string param_no_qvalues_
Definition XFDRAlgorithm.h:184
int Int
Signed integer type.
Definition Types.h:72
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition TypeAliases.h:39
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19