OpenMS  2.7.0
IDScoreGetterSetter.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-2021.
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 // $Maintainer: Julianus Pfeuffer $
32 // $Authors: Julianus Pfeuffer $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
42 
43 #include <boost/unordered_map.hpp>
44 
45 #include <vector>
46 #include <unordered_set>
47 
48 namespace OpenMS
49 {
53  struct ScoreToTgtDecLabelPairs // Not a typedef to allow forward declaration.
54  : public std::vector<std::pair<double, double>>
55  {
56  typedef std::vector<std::pair<double, double>> Base;
57  using Base::Base;
58  };
59 
64  {
65 
66  private:
67 
68  template<typename T>
69  struct IsIDType
70  {
71  static bool const value =
72  std::is_same<T, PeptideIdentification>::value || std::is_same<T, ProteinIdentification>::value;
73  };
74 
75  template<typename T>
76  struct IsHitType
77  {
78  static bool const value = std::is_same<T, PeptideHit>::value || std::is_same<T, ProteinHit>::value;
79  };
80 
81  public:
82 
92  //TODO could be done with set of target accessions, too
93  //TODO even better: store nr targets and nr decoys when creating the groups!
94  //TODO alternative scoring is possible, too (e.g. ratio of tgts vs decoys),
95  // this requires templatization of the scores_labels vector though
96  static void getScores_(
97  ScoreToTgtDecLabelPairs &scores_labels,
98  const std::vector<ProteinIdentification::ProteinGroup> &grps,
99  const std::unordered_set<std::string> &decoy_accs);
100 
101  static void getScores_(
102  ScoreToTgtDecLabelPairs &scores_labels,
103  const ProteinIdentification &id)
104  {
105 
106  scores_labels.reserve(scores_labels.size() + id.getHits().size());
107  std::transform(id.getHits().begin(), id.getHits().end(),
108  std::back_inserter(scores_labels),
109  [](const ProteinHit &hit)
110  {
111  checkTDAnnotation_(hit);
112  return std::make_pair<double, bool>(hit.getScore(), getTDLabel_(hit));
113  }
114  );
115 
116  }
117 
118  static void getScores_(
119  ScoreToTgtDecLabelPairs &scores_labels,
120  const PeptideIdentification &id, bool all_hits, int charge, const String &identifier)
121  {
122  if (id.getIdentifier() == identifier)
123  {
124  getScores_(scores_labels, id, all_hits, charge);
125  }
126  }
127 
128 
129  static void getScores_(
130  ScoreToTgtDecLabelPairs &scores_labels,
131  const PeptideIdentification &id, bool all_hits, const String &identifier)
132  {
133  if (id.getIdentifier() == identifier)
134  {
135  getScores_(scores_labels, id, all_hits);
136  }
137  }
138 
139  static void getScores_(
140  ScoreToTgtDecLabelPairs &scores_labels,
141  const PeptideIdentification &id, int charge, const String &identifier)
142  {
143  if (id.getIdentifier() == identifier)
144  {
145  getScores_(scores_labels, id, charge);
146  }
147  }
148 
149  template<typename IDType, typename std::enable_if<IsIDType<IDType>::value>::type * = nullptr>
150  static void getScores_(
151  ScoreToTgtDecLabelPairs &scores_labels,
152  const IDType &id, const String &identifier)
153  {
154  if (id.getIdentifier() == identifier)
155  {
156  getScores_(scores_labels, id);
157  }
158  }
159 
160  template<class ...Args>
161  static void getScores_(
162  ScoreToTgtDecLabelPairs &scores_labels,
163  const PeptideIdentification &id,
164  bool all_hits,
165  Args &&... args)
166  {
167  if (all_hits)
168  {
169  for (const PeptideHit &hit : id.getHits())
170  {
171  getScores_(scores_labels, hit, std::forward<Args>(args)...);
172  }
173  }
174  else
175  {
176  //TODO for speed I assume that they are sorted and first = best.
177  //id.sort();
178  const PeptideHit &hit = id.getHits()[0];
179  getScores_(scores_labels, hit, std::forward<Args>(args)...);
180  }
181  }
182 
183  static void getScores_(
184  ScoreToTgtDecLabelPairs &scores_labels,
185  const PeptideHit &hit,
186  int charge)
187  {
188  if (charge == hit.getCharge())
189  {
190  checkTDAnnotation_(hit);
191  scores_labels.emplace_back(hit.getScore(), getTDLabel_(hit));
192  }
193  }
194 
195  static void getScores_(
196  ScoreToTgtDecLabelPairs &scores_labels,
197  const PeptideIdentification &id,
198  int charge)
199  {
200  for (const PeptideHit &hit : id.getHits())
201  {
202  getScores_(scores_labels, hit, charge);
203  }
204  }
205 
206  template<typename HitType, typename std::enable_if<IsHitType<HitType>::value>::type * = nullptr>
207  static void getScores_(
208  ScoreToTgtDecLabelPairs &scores_labels,
209  const HitType &hit)
210  {
211  checkTDAnnotation_(hit);
212  scores_labels.emplace_back(hit.getScore(), getTDLabel_(hit));
213  }
214 
215  template<typename IDType, typename std::enable_if<IsIDType<IDType>::value>::type * = nullptr>
216  static void getScores_(
217  ScoreToTgtDecLabelPairs &scores_labels,
218  const IDType &id)
219  {
220  for (const typename IDType::HitType &hit : id.getHits())
221  {
222  getScores_(scores_labels, hit);
223  }
224  }
225 
226  template<class ...Args>
227  static void getScores_(
228  ScoreToTgtDecLabelPairs &scores_labels,
229  const std::vector<PeptideIdentification> &ids,
230  Args &&... args)
231  {
232  for (const auto &id : ids)
233  {
234  getScores_(scores_labels, id, std::forward<Args>(args)...);
235  }
236  }
243  // GCC-OPT 4.8 -- the following functions can be replaced by a
244  // single one with a variadic template, see #4273 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933
246  ScoreToTgtDecLabelPairs &scores_labels,
247  const ConsensusMap &cmap, bool include_unassigned_peptides)
248  {
249  auto f =
250  [&](const PeptideIdentification &id) -> void
251  { getScores_(scores_labels, id); };
252  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
253  }
255  ScoreToTgtDecLabelPairs &scores_labels,
256  const ConsensusMap &cmap, bool include_unassigned_peptides, int charge)
257  {
258  auto f =
259  [&](const PeptideIdentification &id) -> void
260  { getScores_(scores_labels, id, charge); };
261  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
262  }
264  ScoreToTgtDecLabelPairs &scores_labels,
265  const ConsensusMap &cmap, bool include_unassigned_peptides, const String &identifier)
266  {
267  auto f =
268  [&](const PeptideIdentification &id) -> void
269  { getScores_(scores_labels, id, identifier); };
270  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
271  }
273  ScoreToTgtDecLabelPairs &scores_labels,
274  const ConsensusMap &cmap, bool include_unassigned_peptides, int charge, const String &identifier)
275  {
276  auto f =
277  [&](const PeptideIdentification &id) -> void
278  { getScores_(scores_labels, id, charge, identifier); };
279  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
280  }
282  ScoreToTgtDecLabelPairs &scores_labels,
283  const ConsensusMap &cmap, bool include_unassigned_peptides, bool all_hits)
284  {
285  auto f =
286  [&](const PeptideIdentification &id) -> void
287  { getScores_(scores_labels, id, all_hits); };
288  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
289  }
291  ScoreToTgtDecLabelPairs &scores_labels,
292  const ConsensusMap &cmap, bool include_unassigned_peptides, bool all_hits, int charge)
293  {
294  auto f =
295  [&](const PeptideIdentification &id) -> void
296  { getScores_(scores_labels, id, all_hits, charge); };
297  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
298  }
300  ScoreToTgtDecLabelPairs &scores_labels,
301  const ConsensusMap &cmap, bool include_unassigned_peptides, bool all_hits, const String &identifier)
302  {
303  auto f =
304  [&](const PeptideIdentification &id) -> void
305  { getScores_(scores_labels, id, all_hits, identifier); };
306  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
307  }
309  ScoreToTgtDecLabelPairs &scores_labels,
310  const ConsensusMap &cmap, bool include_unassigned_peptides, bool all_hits, int charge, const String &identifier)
311  {
312  auto f =
313  [&](const PeptideIdentification &id) -> void
314  { getScores_(scores_labels, id, all_hits, charge, identifier); };
315  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
316  }
317 
323  static bool getTDLabel_(const MetaInfoInterface &idOrHit)
324  {
325  return std::string(idOrHit.getMetaValue("target_decoy"))[0] == 't';
326  }
327 
339  template<typename IDType, class ...Args>
340  static void setScores_(const std::map<double, double> &scores_to_FDR,
341  std::vector<IDType> &ids,
342  const std::string &score_type,
343  bool higher_better,
344  Args &... args)
345  {
346  for (auto &id : ids)
347  {
348  setScores_(scores_to_FDR, id, score_type, higher_better, &args...);
349  }
350  }
351 
352  template<typename IDType>
353  static String setScoreType_(IDType &id, const std::string &score_type,
354  bool higher_better)
355  {
356  String old_score_type = id.getScoreType() + "_score";
357  id.setScoreType(score_type);
358  id.setHigherScoreBetter(higher_better);
359  return old_score_type;
360  }
361 
362  template<typename IDType>
363  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
364  bool higher_better, bool keep_decoy)
365  {
366  String old_score_type = setScoreType_(id, score_type, higher_better);
367 
368  if (keep_decoy) //in-place set scores
369  {
370  setScores_(scores_to_FDR, id, old_score_type);
371  }
372  else
373  {
374  setScoresAndRemoveDecoys_(scores_to_FDR, id, old_score_type);
375  }
376  }
377 
378  template<typename IDType>
379  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id,
380  const String &old_score_type)
381  {
382  std::vector<typename IDType::HitType> &hits = id.getHits();
383  for (auto &hit : hits)
384  {
385  setScore_(scores_to_FDR, hit, old_score_type);
386  }
387  }
388 
389  template<typename IDType, class ...Args>
390  static void setScoresAndRemoveDecoys_(const std::map<double, double> &scores_to_FDR, IDType &id,
391  const String &old_score_type, Args ... args)
392  {
393  std::vector<typename IDType::HitType> &hits = id.getHits();
394  std::vector<typename IDType::HitType> new_hits;
395  new_hits.reserve(hits.size());
396  for (auto &hit : hits)
397  {
398  setScoreAndMoveIfTarget_(scores_to_FDR, hit, old_score_type, new_hits, args...);
399  }
400  hits.swap(new_hits);
401  }
402 
403  template<typename HitType>
404  static void setScore_(const std::map<double, double> &scores_to_FDR, HitType &hit, const std::string &old_score_type)
405  {
406  hit.setMetaValue(old_score_type, hit.getScore());
407  hit.setScore(scores_to_FDR.lower_bound(hit.getScore())->second);
408  }
409 
410  template<typename IDType>
411  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
412  bool higher_better)
413  {
414  String old_score_type = setScoreType_(id, score_type, higher_better);
415  setScores_(scores_to_FDR, id, old_score_type);
416  }
417 
418  static void setScores_(const std::map<double, double> &scores_to_FDR,
420  const std::string &score_type,
421  bool higher_better,
422  bool keep_decoy,
423  int charge)
424  {
425  String old_score_type = setScoreType_(id, score_type, higher_better);
426  if (keep_decoy) //in-place set scores
427  {
428  setScores_(scores_to_FDR, id, old_score_type, charge);
429  }
430  else
431  {
432  setScoresAndRemoveDecoys_<PeptideIdentification>(scores_to_FDR, id, old_score_type, charge);
433  }
434  }
435 
436  static void setScores_(const std::map<double, double> &scores_to_FDR,
438  const std::string &score_type,
439  bool higher_better,
440  bool keep_decoy,
441  int charge,
442  const String &identifier)
443  {
444  if (id.getIdentifier() == identifier)
445  {
446  setScores_(scores_to_FDR, id, score_type, higher_better, keep_decoy, charge);
447  }
448  }
449 
450  template<typename IDType>
451  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
452  bool higher_better, bool keep_decoy, const String &identifier)
453  {
454  if (id.getIdentifier() == identifier)
455  {
456  setScores_(scores_to_FDR, id, score_type, higher_better, keep_decoy);
457  }
458  }
459 
460  static void setScores_(const std::map<double, double> &scores_to_FDR,
462  const std::string &score_type,
463  bool higher_better,
464  int charge,
465  const String &identifier)
466  {
467  if (id.getIdentifier() == identifier)
468  {
469  setScores_(scores_to_FDR, id, score_type, higher_better, charge);
470  }
471  }
472 
473  template<typename IDType>
474  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
475  bool higher_better, const String &identifier)
476  {
477  if (id.getIdentifier() == identifier)
478  {
479  setScores_(scores_to_FDR, id, score_type, higher_better);
480  }
481  }
482 
483  //TODO could also get a keep_decoy flag when we define what a "decoy group" is -> keep all always for now
484  static void setScores_(
485  const std::map<double, double> &scores_to_FDR,
486  std::vector<ProteinIdentification::ProteinGroup> &grps,
487  const std::string &score_type,
488  bool higher_better);
489 
500  template<typename HitType>
501  static void setScoreAndMoveIfTarget_(const std::map<double, double> &scores_to_FDR,
502  HitType &hit,
503  const std::string &old_score_type,
504  std::vector<HitType> &new_hits)
505  {
506  const String &target_decoy(hit.getMetaValue("target_decoy"));
507  if (target_decoy[0] == 't')
508  {
509  hit.setMetaValue(old_score_type, hit.getScore());
510  hit.setScore(scores_to_FDR.lower_bound(hit.getScore())->second);
511  new_hits.push_back(std::move(hit));
512  } // else do not move over
513  }
514 
523  static void setScoreAndMoveIfTarget_(const std::map<double, double> &scores_to_FDR,
524  PeptideHit &hit,
525  const std::string &old_score_type,
526  std::vector<PeptideHit> &new_hits,
527  int charge)
528  {
529  if (charge == hit.getCharge())
530  {
531  const String &target_decoy(hit.getMetaValue("target_decoy"));
532  if (target_decoy[0] == 't')
533  {
534  hit.setMetaValue(old_score_type, hit.getScore());
535  hit.setScore(scores_to_FDR.lower_bound(hit.getScore())->second);
536  new_hits.push_back(std::move(hit));
537  } // else do not move over
538  }
539  else // different charge, move over unchanged to process later at correct charge.
540  {
541  new_hits.push_back(std::move(hit));
542  }
543  }
544 
555  // GCC-OPT 4.8 -- the following functions can be replaced by a
556  // single one with a variadic template, see #4273 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41933
557  static void setPeptideScoresForMap_(const std::map<double, double> &scores_to_FDR,
558  ConsensusMap &cmap,
559  bool include_unassigned_peptides,
560  const std::string &score_type,
561  bool higher_better,
562  bool keep_decoy)
563  {
564  //Note: Gcc4.8 cannot handle variadic templates in lambdas
565  auto f =
566  [&](PeptideIdentification &id) -> void
567  { setScores_(scores_to_FDR, id, score_type,
568  higher_better, keep_decoy); };
569  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
570  }
571  static void setPeptideScoresForMap_(const std::map<double, double> &scores_to_FDR,
572  ConsensusMap &cmap,
573  bool include_unassigned_peptides,
574  const std::string &score_type,
575  bool higher_better,
576  bool keep_decoy,
577  int charge)
578  {
579  //Note: Gcc4.8 cannot handle variadic templates in lambdas
580  auto f =
581  [&](PeptideIdentification &id) -> void
582  { setScores_(scores_to_FDR, id, score_type,
583  higher_better, keep_decoy, charge); };
584  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
585  }
586  static void setPeptideScoresForMap_(const std::map<double, double> &scores_to_FDR,
587  ConsensusMap &cmap,
588  bool include_unassigned_peptides,
589  const std::string &score_type,
590  bool higher_better,
591  bool keep_decoy,
592  const String& run_identifier)
593  {
594  //Note: Gcc4.8 cannot handle variadic templates in lambdas
595  auto f =
596  [&](PeptideIdentification &id) -> void
597  { setScores_(scores_to_FDR, id, score_type,
598  higher_better, keep_decoy, run_identifier); };
599  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
600  }
601  static void setPeptideScoresForMap_(const std::map<double, double> &scores_to_FDR,
602  ConsensusMap &cmap,
603  bool include_unassigned_peptides,
604  const std::string &score_type,
605  bool higher_better,
606  bool keep_decoy,
607  int charge,
608  const String& run_identifier)
609  {
610  //Note: Gcc4.8 cannot handle variadic templates in lambdas
611  auto f =
612  [&](PeptideIdentification &id) -> void
613  { setScores_(scores_to_FDR, id, score_type,
614  higher_better, keep_decoy, charge, run_identifier); };
615  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
616  }
617 
623  static void checkTDAnnotation_(const MetaInfoInterface &id_or_hit)
624  {
625  if (!id_or_hit.metaValueExists("target_decoy"))
626  {
627  throw Exception::MissingInformation(__FILE__,
628  __LINE__,
629  OPENMS_PRETTY_FUNCTION,
630  "Meta value 'target_decoy' does not exist in all ProteinHits! Reindex the idXML file with 'PeptideIndexer'");
631  }
632  }
633  };
634 } // namespace OpenMS
A container for consensus elements.
Definition: ConsensusMap.h:88
Not all required information provided.
Definition: Exception.h:189
A class for extracting and reinserting IDScores from Peptide/ProteinIdentifications and from Consensu...
Definition: IDScoreGetterSetter.h:64
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides, int charge)
Definition: IDScoreGetterSetter.h:254
static void setPeptideScoresForMap_(const std::map< double, double > &scores_to_FDR, ConsensusMap &cmap, bool include_unassigned_peptides, const std::string &score_type, bool higher_better, bool keep_decoy, int charge)
Definition: IDScoreGetterSetter.h:571
static void setPeptideScoresForMap_(const std::map< double, double > &scores_to_FDR, ConsensusMap &cmap, bool include_unassigned_peptides, const std::string &score_type, bool higher_better, bool keep_decoy, int charge, const String &run_identifier)
Definition: IDScoreGetterSetter.h:601
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides, bool all_hits, int charge, const String &identifier)
Definition: IDScoreGetterSetter.h:308
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides)
Helper for getting scores in ConsensusMaps.
Definition: IDScoreGetterSetter.h:245
static void setScoreAndMoveIfTarget_(const std::map< double, double > &scores_to_FDR, HitType &hit, const std::string &old_score_type, std::vector< HitType > &new_hits)
Used when keep_decoy_peptides or proteins is false.
Definition: IDScoreGetterSetter.h:501
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides, const String &identifier)
Definition: IDScoreGetterSetter.h:263
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides, bool all_hits)
Definition: IDScoreGetterSetter.h:281
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides, int charge, const String &identifier)
Definition: IDScoreGetterSetter.h:272
static bool getTDLabel_(const MetaInfoInterface &idOrHit)
For peptide hits, a hit is considered target also if it maps to both a target and a decoy protein (i....
Definition: IDScoreGetterSetter.h:323
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides, bool all_hits, int charge)
Definition: IDScoreGetterSetter.h:290
static void checkTDAnnotation_(const MetaInfoInterface &id_or_hit)
To check the metavalues before we do anything.
Definition: IDScoreGetterSetter.h:623
static void setPeptideScoresForMap_(const std::map< double, double > &scores_to_FDR, ConsensusMap &cmap, bool include_unassigned_peptides, const std::string &score_type, bool higher_better, bool keep_decoy)
Helper for applying set Scores on ConsensusMaps.
Definition: IDScoreGetterSetter.h:557
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides, bool all_hits, const String &identifier)
Definition: IDScoreGetterSetter.h:299
static void setPeptideScoresForMap_(const std::map< double, double > &scores_to_FDR, ConsensusMap &cmap, bool include_unassigned_peptides, const std::string &score_type, bool higher_better, bool keep_decoy, const String &run_identifier)
Definition: IDScoreGetterSetter.h:586
static void setScoreAndMoveIfTarget_(const std::map< double, double > &scores_to_FDR, PeptideHit &hit, const std::string &old_score_type, std::vector< PeptideHit > &new_hits, int charge)
Used when keep_decoy_peptides is false and charge states are considered.
Definition: IDScoreGetterSetter.h:523
void applyFunctionOnPeptideIDs(T &&f, bool include_unassigned=true)
applies a function on all PeptideIDs or only assigned ones
Definition: MapUtilities.h:68
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:61
bool metaValueExists(const String &name) const
Returns whether an entry with the given name exists.
void setMetaValue(const String &name, const DataValue &value)
Sets the DataValue corresponding to a name.
const DataValue & getMetaValue(const String &name, const DataValue &default_value=DataValue::EMPTY) const
Returns the value corresponding to a string, or a default value (default: DataValue::EMPTY) if not fo...
Representation of a peptide hit.
Definition: PeptideHit.h:57
double getScore() const
returns the PSM score
Int getCharge() const
returns the charge of the peptide
void setScore(double score)
sets the PSM score
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:65
Representation of a protein hit.
Definition: ProteinHit.h:60
double getScore() const
returns the score of the protein hit
Representation of a protein identification run.
Definition: ProteinIdentification.h:72
A more convenient string class.
Definition: String.h:61
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const IDType &id, const String &identifier)
Definition: IDScoreGetterSetter.h:150
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideIdentification &id, int charge)
Definition: IDScoreGetterSetter.h:195
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideIdentification &id, int charge, const String &identifier)
Definition: IDScoreGetterSetter.h:139
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const IDType &id)
Definition: IDScoreGetterSetter.h:216
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideHit &hit, int charge)
Definition: IDScoreGetterSetter.h:183
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const std::vector< PeptideIdentification > &ids, Args &&... args)
Definition: IDScoreGetterSetter.h:227
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const HitType &hit)
Definition: IDScoreGetterSetter.h:207
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideIdentification &id, bool all_hits, const String &identifier)
Definition: IDScoreGetterSetter.h:129
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const std::vector< ProteinIdentification::ProteinGroup > &grps, const std::unordered_set< std::string > &decoy_accs)
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const ProteinIdentification &id)
Definition: IDScoreGetterSetter.h:101
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideIdentification &id, bool all_hits, int charge, const String &identifier)
Definition: IDScoreGetterSetter.h:118
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideIdentification &id, bool all_hits, Args &&... args)
Definition: IDScoreGetterSetter.h:161
static void setScoresAndRemoveDecoys_(const std::map< double, double > &scores_to_FDR, IDType &id, const String &old_score_type, Args ... args)
Definition: IDScoreGetterSetter.h:390
static void setScores_(const std::map< double, double > &scores_to_FDR, std::vector< ProteinIdentification::ProteinGroup > &grps, const std::string &score_type, bool higher_better)
static String setScoreType_(IDType &id, const std::string &score_type, bool higher_better)
Definition: IDScoreGetterSetter.h:353
static void setScores_(const std::map< double, double > &scores_to_FDR, PeptideIdentification &id, const std::string &score_type, bool higher_better, bool keep_decoy, int charge, const String &identifier)
Definition: IDScoreGetterSetter.h:436
static void setScores_(const std::map< double, double > &scores_to_FDR, IDType &id, const std::string &score_type, bool higher_better, bool keep_decoy, const String &identifier)
Definition: IDScoreGetterSetter.h:451
static void setScores_(const std::map< double, double > &scores_to_FDR, PeptideIdentification &id, const std::string &score_type, bool higher_better, bool keep_decoy, int charge)
Definition: IDScoreGetterSetter.h:418
static void setScores_(const std::map< double, double > &scores_to_FDR, std::vector< IDType > &ids, const std::string &score_type, bool higher_better, Args &... args)
Definition: IDScoreGetterSetter.h:340
static void setScore_(const std::map< double, double > &scores_to_FDR, HitType &hit, const std::string &old_score_type)
Definition: IDScoreGetterSetter.h:404
static void setScores_(const std::map< double, double > &scores_to_FDR, IDType &id, const std::string &score_type, bool higher_better)
Definition: IDScoreGetterSetter.h:411
static void setScores_(const std::map< double, double > &scores_to_FDR, IDType &id, const std::string &score_type, bool higher_better, bool keep_decoy)
Definition: IDScoreGetterSetter.h:363
static void setScores_(const std::map< double, double > &scores_to_FDR, PeptideIdentification &id, const std::string &score_type, bool higher_better, int charge, const String &identifier)
Definition: IDScoreGetterSetter.h:460
static void setScores_(const std::map< double, double > &scores_to_FDR, IDType &id, const String &old_score_type)
Definition: IDScoreGetterSetter.h:379
static void setScores_(const std::map< double, double > &scores_to_FDR, IDType &id, const std::string &score_type, bool higher_better, const String &identifier)
Definition: IDScoreGetterSetter.h:474
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Definition: IDScoreGetterSetter.h:77
static bool const value
Definition: IDScoreGetterSetter.h:78
Definition: IDScoreGetterSetter.h:70
static bool const value
Definition: IDScoreGetterSetter.h:71
Definition: IDScoreGetterSetter.h:55
std::vector< std::pair< double, double > > Base
Definition: IDScoreGetterSetter.h:56