OpenMS  3.0.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-2022.
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 <vector>
44 #include <unordered_set>
45 #include <unordered_map>
46 
47 namespace OpenMS
48 {
53  typedef std::pair<double, double> ScoreToTgtDecLabelPair;
54 
55  struct ScoreToTgtDecLabelPairs // Not a typedef to allow forward declaration.
56  : public std::vector<ScoreToTgtDecLabelPair>
57  {
58  typedef std::vector<ScoreToTgtDecLabelPair> Base;
59  using Base::Base;
60  };
61 
66  {
67 
68  private:
69 
70  template<typename T>
71  struct IsIDType
72  {
73  static bool const value =
74  std::is_same<T, PeptideIdentification>::value || std::is_same<T, ProteinIdentification>::value;
75  };
76 
77  template<typename T>
78  struct IsHitType
79  {
80  static bool const value = std::is_same<T, PeptideHit>::value || std::is_same<T, ProteinHit>::value;
81  };
82 
83  public:
92  static void getPickedProteinScores_(
93  std::unordered_map<String, ScoreToTgtDecLabelPair>& picked_scores,
94  const ProteinIdentification& id,
95  const String& decoy_string,
96  bool decoy_prefix);
97 
106  static void getPickedProteinGroupScores_(
107  const std::unordered_map<String, ScoreToTgtDecLabelPair>& picked_scores,
108  ScoreToTgtDecLabelPairs& scores_labels,
109  const std::vector<ProteinIdentification::ProteinGroup>& grps,
110  const String& decoy_string,
111  bool decoy_prefix);
112 
114  static std::pair<bool,String> removeDecoyStringIfPresent_(const String& acc, const String& decoy_string, bool decoy_prefix);
115 
125  //TODO could be done with set of target accessions, too
126  //TODO even better: store nr targets and nr decoys when creating the groups!
127  //TODO alternative scoring is possible, too (e.g. ratio of tgts vs decoys)
128  static void getScores_(
129  ScoreToTgtDecLabelPairs &scores_labels,
130  const std::vector<ProteinIdentification::ProteinGroup> &grps,
131  const std::unordered_set<std::string> &decoy_accs);
132 
133 
134  template<class ...Args>
135  static void getScores_(
136  ScoreToTgtDecLabelPairs &scores_labels,
137  const std::vector<PeptideIdentification> &ids,
138  Args &&... args)
139  {
140  for (const PeptideIdentification &id : ids)
141  {
142  getScores_(scores_labels, id, std::forward<Args>(args)...);
143  }
144  }
145 
146  static void getScores_(
147  ScoreToTgtDecLabelPairs &scores_labels,
148  const ProteinIdentification &id)
149  {
150  scores_labels.reserve(scores_labels.size() + id.getHits().size());
151  std::transform(id.getHits().begin(), id.getHits().end(),
152  std::back_inserter(scores_labels),
153  [](const ProteinHit &hit)
154  {
155  checkTDAnnotation_(hit);
156  return std::make_pair<double, bool>(hit.getScore(), getTDLabel_(hit));
157  }
158  );
159  }
160 
161  template<class ...Args>
162  static void getScores_(
163  ScoreToTgtDecLabelPairs &scores_labels,
164  const PeptideIdentification &id,
165  bool all_hits,
166  Args &&... args
167  )
168  {
169  if (all_hits)
170  {
171  for (const PeptideHit &hit : id.getHits())
172  {
173  getScores_(scores_labels, hit, std::forward<Args>(args)...);
174  }
175  }
176  else
177  {
178  //TODO for speed and constness I assume that they are sorted and first = best.
179  //id.sort();
180  const PeptideHit &hit = id.getHits()[0];
181  getScores_(scores_labels, hit, std::forward<Args>(args)...);
182  }
183  }
184 
185  template<typename IDPredicate, class ...Args>
186  static void getScores_(
187  ScoreToTgtDecLabelPairs &scores_labels,
188  const PeptideIdentification &id,
189  IDPredicate &&fun,
190  bool all_hits,
191  Args &&... args
192  )
193  {
194  if (fun(id))
195  {
196  if (all_hits)
197  {
198  for (const PeptideHit &hit : id.getHits())
199  {
200  getScores_(scores_labels, hit, std::forward<Args>(args)...);
201  }
202  }
203  else
204  {
205  //TODO for speed I assume that they are sorted and first = best.
206  //id.sort();
207  const PeptideHit &hit = id.getHits()[0];
208  getScores_(scores_labels, hit, std::forward<Args>(args)...);
209  }
210  }
211  }
212 
213  template<typename HitPredicate>
214  static void getScores_(
215  ScoreToTgtDecLabelPairs &scores_labels,
216  const PeptideHit &hit,
217  HitPredicate &&fun)
218  {
219  if (fun(hit))
220  {
221  getScores_(scores_labels, hit);
222  }
223  }
224 
225  template<typename HitType, typename std::enable_if<IsHitType<HitType>::value>::type * = nullptr>
226  static void getScores_(
227  ScoreToTgtDecLabelPairs &scores_labels,
228  const HitType &hit)
229  {
230  checkTDAnnotation_(hit);
231  scores_labels.emplace_back(hit.getScore(), getTDLabel_(hit));
232  }
241  template<class ...Args>
243  ScoreToTgtDecLabelPairs &scores_labels,
244  const ConsensusMap &cmap, bool include_unassigned_peptides, Args &&... args)
245  {
246  auto f =
247  [&](const PeptideIdentification &id) -> void
248  { getScores_(scores_labels, id, std::forward<Args>(args)...); };
249  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
250  }
251 
257  static bool getTDLabel_(const MetaInfoInterface &idOrHit)
258  {
259  return std::string(idOrHit.getMetaValue("target_decoy"))[0] == 't';
260  }
261 
273  template<typename IDType, class ...Args>
274  static void setScores_(const std::map<double, double> &scores_to_FDR,
275  std::vector<IDType> &ids,
276  const std::string &score_type,
277  bool higher_better,
278  Args &&... args)
279  {
280  for (auto &id : ids)
281  {
282  setScores_(scores_to_FDR, id, score_type, higher_better, std::forward<Args>(args)...);
283  }
284  }
285 
286  template<typename IDType>
287  static String setScoreType_(IDType &id, const std::string &score_type,
288  bool higher_better)
289  {
290  String old_score_type = id.getScoreType() + "_score";
291  id.setScoreType(score_type);
292  id.setHigherScoreBetter(higher_better);
293  return old_score_type;
294  }
295 
296  template<typename IDType>
297  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
298  bool higher_better, bool keep_decoy)
299  {
300  bool old_higher_better = id.isHigherScoreBetter();
301  String old_score_type = setScoreType_(id, score_type, higher_better);
302 
303  if (keep_decoy) //in-place set scores
304  {
305  if (old_higher_better)
306  {
307  setScores_(scores_to_FDR, id, old_score_type);
308  }
309  else
310  {
311  setScoresHigherWorse_(scores_to_FDR, id, old_score_type);
312  }
313  }
314  else
315  {
316  if (old_higher_better)
317  {
318  setScoresAndRemoveDecoys_(scores_to_FDR, id, old_score_type);
319  }
320  else
321  {
322  setScoresHigherWorseAndRemoveDecoys_(scores_to_FDR, id, old_score_type);
323  }
324  }
325  }
326 
327  template<typename IDType>
328  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id,
329  const String &old_score_type)
330  {
331  std::vector<typename IDType::HitType> &hits = id.getHits();
332  for (auto &hit : hits)
333  {
334  setScore_(scores_to_FDR, hit, old_score_type);
335  }
336  }
337 
338  template<typename IDType>
339  static void setScoresHigherWorse_(const std::map<double, double> &scores_to_FDR, IDType &id,
340  const String &old_score_type)
341  {
342  std::vector<typename IDType::HitType> &hits = id.getHits();
343  for (auto &hit : hits)
344  {
345  setScoreHigherWorse_(scores_to_FDR, hit, old_score_type);
346  }
347  }
348 
349  template<typename IDType, class ...Args>
350  static void setScoresAndRemoveDecoys_(const std::map<double, double> &scores_to_FDR, IDType &id,
351  const String &old_score_type, Args&& ... args)
352  {
353  std::vector<typename IDType::HitType> &hits = id.getHits();
354  std::vector<typename IDType::HitType> new_hits;
355  new_hits.reserve(hits.size());
356  for (auto &hit : hits)
357  {
358  setScoreAndMoveIfTarget_(scores_to_FDR, hit, old_score_type, new_hits, std::forward<Args>(args)...);
359  }
360  hits.swap(new_hits);
361  }
362 
363  template<typename IDType, class ...Args>
364  static void setScoresHigherWorseAndRemoveDecoys_(const std::map<double, double> &scores_to_FDR, IDType &id,
365  const String &old_score_type, Args&& ... args)
366  {
367  std::vector<typename IDType::HitType> &hits = id.getHits();
368  std::vector<typename IDType::HitType> new_hits;
369  new_hits.reserve(hits.size());
370  for (auto &hit : hits)
371  {
372  setScoreHigherWorseAndMoveIfTarget_(scores_to_FDR, hit, old_score_type, new_hits, std::forward<Args>(args)...);
373  }
374  hits.swap(new_hits);
375  }
376 
377  template<typename HitType>
378  static void setScore_(const std::map<double, double> &scores_to_FDR, HitType &hit, const std::string &old_score_type)
379  {
380  hit.setMetaValue(old_score_type, hit.getScore());
381  hit.setScore(scores_to_FDR.lower_bound(hit.getScore())->second);
382  }
383 
384  template<typename HitType>
385  static void setScoreHigherWorse_(const std::map<double, double> &scores_to_FDR, HitType &hit, const std::string &old_score_type)
386  {
387  hit.setMetaValue(old_score_type, hit.getScore());
388  auto ub = scores_to_FDR.upper_bound(hit.getScore());
389  if (ub != scores_to_FDR.begin()) ub--;
390  hit.setScore(ub->second);
391  }
392 
393  /*template<typename IDType>
394  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
395  bool higher_better)
396  {
397  bool old_higher_better = id.isHigherScoreBetter();
398  String old_score_type = setScoreType_(id, score_type, higher_better);
399  setScores_(scores_to_FDR, id, old_score_type, old_higher_better);
400  }*/
401 
402  static void setScores_(const std::map<double, double> &scores_to_FDR,
404  const std::string &score_type,
405  bool higher_better,
406  bool keep_decoy,
407  int charge)
408  {
409  String old_score_type = setScoreType_(id, score_type, higher_better);
410  if (keep_decoy) //in-place set scores
411  {
412  setScores_(scores_to_FDR, id, old_score_type, higher_better, charge);
413  }
414  else
415  {
416  setScoresAndRemoveDecoys_<PeptideIdentification>(scores_to_FDR, id, old_score_type, charge);
417  }
418  }
419 
420  static void setScores_(const std::map<double, double> &scores_to_FDR,
422  const std::string &score_type,
423  bool higher_better,
424  bool keep_decoy,
425  int charge,
426  const String &identifier)
427  {
428  if (id.getIdentifier() == identifier)
429  {
430  setScores_(scores_to_FDR, id, score_type, higher_better, keep_decoy, charge);
431  }
432  }
433 
434  template<typename IDType>
435  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
436  bool higher_better, bool keep_decoy, const String &identifier)
437  {
438  if (id.getIdentifier() == identifier)
439  {
440  setScores_(scores_to_FDR, id, score_type, higher_better, keep_decoy);
441  }
442  }
443 
444  static void setScores_(const std::map<double, double> &scores_to_FDR,
446  const std::string &score_type,
447  bool higher_better,
448  int charge,
449  const String &identifier)
450  {
451  if (id.getIdentifier() == identifier)
452  {
453  setScores_(scores_to_FDR, id, score_type, higher_better, charge);
454  }
455  }
456 
457  template<typename IDType>
458  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
459  bool higher_better, const String &identifier)
460  {
461  if (id.getIdentifier() == identifier)
462  {
463  setScores_(scores_to_FDR, id, score_type, higher_better);
464  }
465  }
466 
467  template<typename IDType>
468  static void setScores_(const std::map<double, double> &scores_to_FDR, IDType &id, const std::string &score_type,
469  bool higher_better, int charge)
470  {
471  for (auto& hit : id.getHits())
472  {
473  if (hit.getCharge() == charge)
474  {
475  if (higher_better)
476  {
477  setScore_(scores_to_FDR, hit, score_type);
478  }
479  else
480  {
481  setScoreHigherWorse_(scores_to_FDR, hit, score_type);
482  }
483  }
484  }
485  }
486 
487  //TODO could also get a keep_decoy flag when we define what a "decoy group" is -> keep all always for now
488  static void setScores_(
489  const std::map<double, double> &scores_to_FDR,
490  std::vector<ProteinIdentification::ProteinGroup> &grps,
491  const std::string &score_type,
492  bool higher_better);
493 
504  template<typename HitType>
505  static void setScoreAndMoveIfTarget_(const std::map<double, double> &scores_to_FDR,
506  HitType &hit,
507  const std::string &old_score_type,
508  std::vector<HitType> &new_hits)
509  {
510  const String &target_decoy(hit.getMetaValue("target_decoy"));
511  if (target_decoy[0] == 't')
512  {
513  hit.setMetaValue(old_score_type, hit.getScore());
514  hit.setScore(scores_to_FDR.lower_bound(hit.getScore())->second);
515  new_hits.push_back(std::move(hit));
516  } // else do not move over
517  }
518 
519  template<typename HitType>
520  static void setScoreHigherWorseAndMoveIfTarget_(const std::map<double, double> &scores_to_FDR,
521  HitType &hit,
522  const std::string &old_score_type,
523  std::vector<HitType> &new_hits)
524  {
525  const String &target_decoy(hit.getMetaValue("target_decoy"));
526  if (target_decoy[0] == 't')
527  {
528  hit.setMetaValue(old_score_type, hit.getScore());
529  auto ub = scores_to_FDR.upper_bound(hit.getScore());
530  if (ub != scores_to_FDR.begin()) ub--;
531  hit.setScore(ub->second);
532  new_hits.push_back(std::move(hit));
533  } // else do not move over
534  }
535 
536 
545  static void setScoreAndMoveIfTarget_(const std::map<double, double> &scores_to_FDR,
546  PeptideHit &hit,
547  const std::string &old_score_type,
548  std::vector<PeptideHit> &new_hits,
549  int charge)
550  {
551  if (charge == hit.getCharge())
552  {
553  const String &target_decoy(hit.getMetaValue("target_decoy"));
554  if (target_decoy[0] == 't')
555  {
556  hit.setMetaValue(old_score_type, hit.getScore());
557  hit.setScore(scores_to_FDR.lower_bound(hit.getScore())->second);
558  new_hits.push_back(std::move(hit));
559  } // else do not move over
560  }
561  else // different charge, move over unchanged to process later at correct charge.
562  {
563  new_hits.push_back(std::move(hit));
564  }
565  }
566 
577  template<class ...Args>
578  static void setPeptideScoresForMap_(const std::map<double, double> &scores_to_FDR,
579  ConsensusMap &cmap,
580  bool include_unassigned_peptides,
581  const std::string &score_type,
582  bool higher_better,
583  bool keep_decoy,
584  Args&&... args)
585  {
586  //Note: Gcc4.8 cannot handle variadic templates in lambdas
587  auto f =
588  [&](PeptideIdentification &id) -> void
589  { setScores_(scores_to_FDR, id, score_type,
590  higher_better, keep_decoy, std::forward<Args>(args)...); };
591  cmap.applyFunctionOnPeptideIDs(f, include_unassigned_peptides);
592  }
593 
599  static void checkTDAnnotation_(const MetaInfoInterface &id_or_hit)
600  {
601  if (!id_or_hit.metaValueExists("target_decoy"))
602  {
603  throw Exception::MissingInformation(__FILE__,
604  __LINE__,
605  OPENMS_PRETTY_FUNCTION,
606  "Meta value 'target_decoy' does not exist in all ProteinHits! Reindex the idXML file with 'PeptideIndexer'");
607  }
608  }
609  };
610 } // namespace OpenMS
LogStream.h
OpenMS::IDScoreGetterSetter::setScoresHigherWorse_
static void setScoresHigherWorse_(const std::map< double, double > &scores_to_FDR, IDType &id, const String &old_score_type)
Definition: IDScoreGetterSetter.h:339
DefaultParamHandler.h
OpenMS::PeptideHit::getCharge
Int getCharge() const
returns the charge of the peptide
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:147
OpenMS::IDScoreGetterSetter::setScores_
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:444
Size
OpenMS::IDScoreGetterSetter::getScores_
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const HitType &hit)
Definition: IDScoreGetterSetter.h:226
OpenMS::IdXMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &protein_ids, const std::vector< PeptideIdentification > &peptide_ids, const String &document_id="")
Stores the data in an idXML file.
OpenMS::IDScoreGetterSetter::getScores_
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const std::vector< PeptideIdentification > &ids, Args &&... args)
Definition: IDScoreGetterSetter.h:135
OpenMS::IDScoreGetterSetter::getPickedProteinScores_
static void getPickedProteinScores_(std::unordered_map< String, ScoreToTgtDecLabelPair > &picked_scores, const ProteinIdentification &id, const String &decoy_string, bool decoy_prefix)
Fills the scores_labels vector from an ProteinIdentification id for picked protein FDR....
OpenMS::IDScoreGetterSetter::getPickedProteinGroupScores_
static void getPickedProteinGroupScores_(const std::unordered_map< String, ScoreToTgtDecLabelPair > &picked_scores, ScoreToTgtDecLabelPairs &scores_labels, const std::vector< ProteinIdentification::ProteinGroup > &grps, const String &decoy_string, bool decoy_prefix)
Fills the scores_labels vector from a vector of ProteinGroups grps for picked protein group FDR.
OpenMS::IDScoreGetterSetter::getScores_
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideHit &hit, HitPredicate &&fun)
Definition: IDScoreGetterSetter.h:214
OpenMS::MetaInfoInterface::getMetaValue
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...
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::IDScoreGetterSetter::setScoreAndMoveIfTarget_
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:545
ConsensusMap.h
OpenMS::IDScoreGetterSetter::setScoreAndMoveIfTarget_
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:505
OpenMS::IDScoreGetterSetter::IsIDType::value
static const bool value
Definition: IDScoreGetterSetter.h:73
IdXMLFile.h
OpenMS::ProteinHit
Representation of a protein hit.
Definition: ProteinHit.h:58
OpenMS::IDScoreGetterSetter::getScores_
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideIdentification &id, IDPredicate &&fun, bool all_hits, Args &&... args)
Definition: IDScoreGetterSetter.h:186
OpenMS::ProteinIdentification
Representation of a protein identification run.
Definition: ProteinIdentification.h:70
OpenMS::IDScoreGetterSetter::setPeptideScoresForMap_
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, Args &&... args)
Helper for applying set Scores on ConsensusMaps.
Definition: IDScoreGetterSetter.h:578
OpenMS::IDScoreGetterSetter::setScores_
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:297
OpenMS::IdXMLFile::load
void load(const String &filename, std::vector< ProteinIdentification > &protein_ids, std::vector< PeptideIdentification > &peptide_ids)
Loads the identifications of an idXML file without identifier.
OpenMS::IDScoreGetterSetter::setScoreHigherWorseAndMoveIfTarget_
static void setScoreHigherWorseAndMoveIfTarget_(const std::map< double, double > &scores_to_FDR, HitType &hit, const std::string &old_score_type, std::vector< HitType > &new_hits)
Definition: IDScoreGetterSetter.h:520
OpenMS::IDScoreGetterSetter::setScoresHigherWorseAndRemoveDecoys_
static void setScoresHigherWorseAndRemoveDecoys_(const std::map< double, double > &scores_to_FDR, IDType &id, const String &old_score_type, Args &&... args)
Definition: IDScoreGetterSetter.h:364
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::MetaInfoInterface::setMetaValue
void setMetaValue(const String &name, const DataValue &value)
Sets the DataValue corresponding to a name.
OpenMS::IDScoreGetterSetter
A class for extracting and reinserting IDScores from Peptide/ProteinIdentifications and from Consensu...
Definition: IDScoreGetterSetter.h:65
OpenMS::MetaInfoInterface
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
OpenMS::IDScoreGetterSetter::getScores_
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const ProteinIdentification &id)
Definition: IDScoreGetterSetter.h:146
OpenMS::IDScoreGetterSetter::setScores_
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:420
ProteinIdentification.h
OpenMS::MapUtilities::applyFunctionOnPeptideIDs
void applyFunctionOnPeptideIDs(T &&f, bool include_unassigned=true)
applies a function on all PeptideIDs or only assigned ones
Definition: MapUtilities.h:68
OpenMS::IDScoreGetterSetter::setScoresAndRemoveDecoys_
static void setScoresAndRemoveDecoys_(const std::map< double, double > &scores_to_FDR, IDType &id, const String &old_score_type, Args &&... args)
Definition: IDScoreGetterSetter.h:350
OpenMS::IDScoreGetterSetter::getScores_
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const PeptideIdentification &id, bool all_hits, Args &&... args)
Definition: IDScoreGetterSetter.h:162
OpenMS::ConsensusMap
A container for consensus elements.
Definition: ConsensusMap.h:82
OpenMS::IDScoreGetterSetter::getPeptideScoresFromMap_
static void getPeptideScoresFromMap_(ScoreToTgtDecLabelPairs &scores_labels, const ConsensusMap &cmap, bool include_unassigned_peptides, Args &&... args)
Helper for getting scores in ConsensusMaps.
Definition: IDScoreGetterSetter.h:242
OpenMS::IDScoreGetterSetter::setScores_
static void setScores_(const std::map< double, double > &scores_to_FDR, IDType &id, const String &old_score_type)
Definition: IDScoreGetterSetter.h:328
OpenMS::IDScoreGetterSetter::setScores_
static void setScores_(const std::map< double, double > &scores_to_FDR, IDType &id, const std::string &score_type, bool higher_better, int charge)
Definition: IDScoreGetterSetter.h:468
OpenMS::IDScoreGetterSetter::IsHitType::value
static const bool value
Definition: IDScoreGetterSetter.h:80
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:71
OpenMS::IDScoreGetterSetter::IsIDType
Definition: IDScoreGetterSetter.h:71
OpenMS::ScoreToTgtDecLabelPairs::Base
std::vector< ScoreToTgtDecLabelPair > Base
Definition: IDScoreGetterSetter.h:58
OpenMS::IDScoreGetterSetter::setScoreType_
static String setScoreType_(IDType &id, const std::string &score_type, bool higher_better)
Definition: IDScoreGetterSetter.h:287
OpenMS::ScoreToTgtDecLabelPair
std::pair< double, double > ScoreToTgtDecLabelPair
Definition: IDScoreGetterSetter.h:53
OPENMS_LOG_ERROR
#define OPENMS_LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:455
OpenMS::PeptideIdentification
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:63
OpenMS::MetaInfoInterface::metaValueExists
bool metaValueExists(const String &name) const
Returns whether an entry with the given name exists.
OpenMS::IDScoreGetterSetter::IsHitType
Definition: IDScoreGetterSetter.h:78
OpenMS::PeptideHit::getScore
double getScore() const
returns the PSM score
OpenMS::IDScoreGetterSetter::getScores_
static void getScores_(ScoreToTgtDecLabelPairs &scores_labels, const std::vector< ProteinIdentification::ProteinGroup > &grps, const std::unordered_set< std::string > &decoy_accs)
OpenMS::ScoreToTgtDecLabelPairs
Definition: IDScoreGetterSetter.h:55
OpenMS::IDScoreGetterSetter::setScoreHigherWorse_
static void setScoreHigherWorse_(const std::map< double, double > &scores_to_FDR, HitType &hit, const std::string &old_score_type)
Definition: IDScoreGetterSetter.h:385
OpenMS::IDScoreGetterSetter::removeDecoyStringIfPresent_
static std::pair< bool, String > removeDecoyStringIfPresent_(const String &acc, const String &decoy_string, bool decoy_prefix)
removes the decoy_string from acc if present. Returns if string was removed and the new string.
OpenMS::IDScoreGetterSetter::setScores_
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:435
OpenMS::IDScoreGetterSetter::setScores_
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:274
OpenMS::IDScoreGetterSetter::setScore_
static void setScore_(const std::map< double, double > &scores_to_FDR, HitType &hit, const std::string &old_score_type)
Definition: IDScoreGetterSetter.h:378
IdentificationData.h
OpenMS::Exception::MissingInformation
Not all required information provided.
Definition: Exception.h:186
OpenMS::ProteinHit::getScore
double getScore() const
returns the score of the protein hit
OpenMS::Internal::Args
custom arguments to allow for looping calls
Definition: WizardHelper.h:72
PeptideIdentification.h
OpenMS::IDScoreGetterSetter::setScores_
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:458
OpenMS::IDScoreGetterSetter::setScores_
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:402
OpenMS::IDScoreGetterSetter::getTDLabel_
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:257
OpenMS::IDScoreGetterSetter::checkTDAnnotation_
static void checkTDAnnotation_(const MetaInfoInterface &id_or_hit)
To check the metavalues before we do anything.
Definition: IDScoreGetterSetter.h:599
TOPPBase.h
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:68
OpenMS::PeptideHit::setScore
void setScore(double score)
sets the PSM score
OpenMS::PeptideHit
Representation of a peptide hit.
Definition: PeptideHit.h:55