OpenMS
IDScoreSwitcherAlgorithm.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: Julianus Pfeuffer $
6 // $Authors: Julianus Pfeuffer $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
16 
17 #include <algorithm>
18 #include <vector>
19 #include <set>
20 #include <map>
21 
22 namespace OpenMS
23 {
24 
40  class OPENMS_DLLAPI IDScoreSwitcherAlgorithm :
41  public DefaultParamHandler
42  {
43  public:
46 
54  enum class ScoreType
55  {
56  RAW,
57  RAW_EVAL,
58  PP,
59  PEP,
60  FDR,
61  QVAL,
62  };
63 
75  bool isScoreType(const String& score_name, const ScoreType& type) const
76  {
77  String chopped = score_name;
78  if (chopped.hasSuffix("_score"))
79  {
80  chopped = chopped.chop(6);
81  }
82  const std::set<String>& possible_types = type_to_str_.at(type);
83  return possible_types.find(chopped) != possible_types.end();
84  }
85 
98  static ScoreType toScoreTypeEnum(String score_type)
99  {
100  if (score_type.hasSuffix("_score"))
101  {
102  score_type = score_type.chop(6);
103  }
104  score_type.toLower();
105  score_type.erase(std::remove_if(score_type.begin(), score_type.end(),
106  [](unsigned char c) { return c == '-' || c == '_' || c == ' '; }),
107  score_type.end());
108 
109  const std::map<String, ScoreType> s_to_type =
110  {
111  {"raw", ScoreType::RAW},
112  {"rawevalue", ScoreType::RAW_EVAL},
113  {"qvalue", ScoreType::QVAL},
114  {"fdr", ScoreType::FDR},
115  {"falsediscoveryrate", ScoreType::FDR},
116  {"pep", ScoreType::PEP},
117  {"posteriorerrorprobability", ScoreType::PEP},
118  {"posteriorprobability", ScoreType::PP},
119  {"pp", ScoreType::PP}
120  };
121 
122  if (auto it = s_to_type.find(score_type); it != s_to_type.end())
123  {
124  return it->second;
125  }
126  else
127  {
128  throw Exception::MissingInformation(__FILE__, __LINE__,
129  OPENMS_PRETTY_FUNCTION, String("Unknown score type '") + score_type + "'.");
130  }
131  }
132 
140  {
141  return type_to_better_[score_type];
142  }
143 
149  std::vector<String> getScoreNames();
150 
155  {
156  bool is_main_score_type = false;
158  };
159 
175  template <typename IDType>
176  ScoreSearchResult findScoreType(const IDType& id, ScoreType score_type) const
177  {
178  ScoreSearchResult result;
179 
180  // First check if main score is already of the requested score type using existing infrastructure
181  const String& main_score_type = id.getScoreType();
182  result.is_main_score_type = isScoreType(main_score_type, score_type);
183 
184  if (result.is_main_score_type)
185  {
186  // Main score is of the requested type, so return the main score name
187  result.score_name = main_score_type;
188  }
189  else if (!id.getHits().empty())
190  {
191  // Main score is not of the requested type, look for it in meta values
192  const auto& first_hit = id.getHits()[0];
193  const std::set<String>& score_types = type_to_str_.at(score_type);
194 
195  // Search for scores of the requested type in meta values using the existing score type collection
196  for (const String& score_name : score_types)
197  {
198  if (first_hit.metaValueExists(score_name))
199  {
200  result.score_name = score_name;
201  break;
202  }
203  // Also check for "_score" suffix variant
204  String score_name_with_suffix = score_name + "_score";
205  if (first_hit.metaValueExists(score_name_with_suffix))
206  {
207  result.score_name = score_name_with_suffix;
208  break;
209  }
210  }
211  }
212  // If neither main score nor meta values contain the requested type, score_name remains empty
213 
214  return result;
215  }
216 
237  template <typename IDType>
238  void switchScores(IDType& id, Size& counter)
239  {
240  for (auto hit_it = id.getHits().begin();
241  hit_it != id.getHits().end(); ++hit_it, ++counter)
242  {
243  if (!hit_it->metaValueExists(new_score_))
244  {
245  std::stringstream msg;
246  msg << "Meta value '" << new_score_ << "' not found for " << *hit_it;
247  throw Exception::MissingInformation(__FILE__, __LINE__,
248  OPENMS_PRETTY_FUNCTION, msg.str());
249  }
250 
251  const String& old_score_meta = (old_score_.empty() ? id.getScoreType() :
252  old_score_);
253  const DataValue& dv = hit_it->getMetaValue(old_score_meta);
254  if (!dv.isEmpty()) // meta value for old score already exists
255  {
256  // TODO: find a better way to check if old score type is something different (even if it has same name)
257  // This currently, is a workaround for e.g., having Percolator_qvalue as meta value and same q-value as main score (getScore()).
258  // Note by jpfeuffer: The problem with this is, that this may add the old score to some of the hits if different, but not
259  // all, in case one is by chance the same. I would be fine with this, if it was done in the beginning and checked
260  // for every score.
261  if (fabs((double(dv) - hit_it->getScore()) * 2.0 /
262  (double(dv) + hit_it->getScore())) > tolerance_)
263  {
264  hit_it->setMetaValue(old_score_meta + "~", hit_it->getScore());
265  }
266  }
267  else
268  {
269  hit_it->setMetaValue(old_score_meta, hit_it->getScore());
270  }
271  hit_it->setScore(hit_it->getMetaValue(new_score_));
272  }
273  id.setScoreType(new_score_type_);
274  id.setHigherScoreBetter(higher_better_);
275  }
276 
303  template<class IDType>
304  void switchToGeneralScoreType(std::vector<IDType>& id, ScoreType type, Size& counter)
305  {
306  if (id.empty()) return;
307 
308  auto sr = findScoreType(id[0], type);
309 
310  // If the main score is already of the requested type, assume all are set correctly
311  if (sr.is_main_score_type)
312  {
313  // we assume that all the other peptide ids
314  // also already have the correct score set
315  return;
316  }
317 
318  // Otherwise we need a score name to switch to
319  if (sr.score_name.empty())
320  {
321  String msg = "First encountered ID does not have the requested score type.";
322  throw Exception::MissingInformation(__FILE__, __LINE__,
323  OPENMS_PRETTY_FUNCTION, msg);
324  }
325 
326  String t = sr.score_name;
327 
328  if (t.hasSuffix("_score"))
329  {
330  new_score_type_ = t.chop(6);
331  }
332  else
333  {
334  new_score_type_ = t;
335  }
336  new_score_ = t;
337 
338  if (higher_better_ != type_to_better_[type])
339  {
340  OPENMS_LOG_WARN << "Requested score type does not match the expected score direction. Correcting!\n";
341  higher_better_ = type_to_better_[type];
342  }
343  for (auto& i : id)
344  {
345  switchScores(i, counter);
346  }
347  }
348 
359  {
360  std::vector<PeptideIdentification>& vec = pep_ids.getData();
361  switchToGeneralScoreType(vec, type, counter);
362  }
363 
377  void switchToGeneralScoreType(ConsensusMap& cmap, ScoreType type, Size& counter, bool unassigned_peptides_too = true)
378  {
379  String new_type = "";
380  for (const auto& f : cmap)
381  {
382  const auto& ids = f.getPeptideIdentifications();
383  if (!ids.empty())
384  {
385  auto sr = findScoreType(ids[0], type);
386  if (sr.is_main_score_type)
387  {
388  return;
389  }
390  if (!sr.score_name.empty())
391  {
392  new_type = sr.score_name;
393  break;
394  }
395  }
396  }
397 
398  if (new_type.empty())
399  {
400  String msg = "First encountered ID does not have the requested score type.";
401  throw Exception::MissingInformation(__FILE__, __LINE__,
402  OPENMS_PRETTY_FUNCTION, msg);
403  }
404 
405  if (new_type.hasSuffix("_score"))
406  {
407  new_score_type_ = new_type.chop(6);
408  }
409  else
410  {
411  new_score_type_ = new_type;
412  }
413  new_score_ = new_type;
414 
415  if (higher_better_ != type_to_better_[type])
416  {
417  OPENMS_LOG_WARN << "Requested score type does not match the expected score direction. Correcting!\n";
418  higher_better_ = type_to_better_[type];
419  }
420 
421  const auto switchScoresSingle = [&counter,this](PeptideIdentification& id){switchScores(id,counter);};
422  cmap.applyFunctionOnPeptideIDs(switchScoresSingle, unassigned_peptides_too);
423  }
424 
439  const PeptideIdentificationList& pep_ids,
440  String& name,
441  bool& higher_better,
442  ScoreType& score_type)
443  {
444  //TODO check all pep IDs? this assumes equality
445  if (!pep_ids.empty())
446  {
447  name = pep_ids[0].getScoreType(); // The name of the score. Typically a name like "XTandem" or "Percolator_qvalue"
448  higher_better = pep_ids[0].isHigherScoreBetter();
449 
450  // look up the score category ("RAW", "PEP", "q-value", etc.) for the given score name
451  for (auto& [scoretype, names] : type_to_str_)
452  {
453  if (names.find(name) != names.end())
454  {
455  score_type = scoretype;
456  OPENMS_LOG_INFO << "Found score type " << name << " to be of type "
457  << static_cast<std::underlying_type<ScoreType>::type>(scoretype) << std::endl;
458  return;
459  }
460  }
461  }
462  }
463 
479  String& name,
480  bool& higher_better,
481  ScoreType& score_type,
482  bool include_unassigned = true)
483  {
484  name = "";
485  higher_better = true;
486 
487  // TODO: check all pep IDs? this assumes equality to first encountered
488  for (const auto& cf : cmap)
489  {
490  const auto& pep_ids = cf.getPeptideIdentifications();
491  if (!pep_ids.empty())
492  {
493  name = pep_ids[0].getScoreType();
494  higher_better = pep_ids[0].isHigherScoreBetter();
495 
496  // look up the score category ("RAW", "PEP", "q-value", etc.) for the given score name
497  for (auto& [scoretype, names] : type_to_str_)
498  {
499  if (names.find(name) != names.end())
500  {
501  score_type = scoretype;
502  return;
503  }
504  }
505  }
506  }
507 
508  if (name.empty() && include_unassigned)
509  {
510  for (const auto& id : cmap.getUnassignedPeptideIdentifications())
511  {
512  name = id.getScoreType();
513  higher_better = id.isHigherScoreBetter();
514 
515  // look up the score category ("RAW", "PEP", "q-value", etc.) for the given score name
516  for (auto& [scoretype, names] : type_to_str_)
517  {
518  if (names.find(name) != names.end())
519  {
520  score_type = scoretype;
521  return;
522  }
523  }
524  return;
525  }
526  }
527  }
528 
542  void switchScores(ConsensusMap& cmap, Size& counter, bool unassigned_peptides_too = true)
543  {
544  for (const auto& f : cmap)
545  {
546  const auto& ids = f.getPeptideIdentifications();
547  if (!ids.empty())
548  {
549  if (new_score_ == ids[0].getScoreType()) // correct score or category already set
550  {
551  return;
552  }
553  else
554  {
555  break;
556  }
557  }
558  }
559  const auto switchScoresSingle = [&counter,this](PeptideIdentification& id){switchScores(id,counter);};
560  cmap.applyFunctionOnPeptideIDs(switchScoresSingle, unassigned_peptides_too);
561  }
562 
575  void switchScores(PeptideIdentificationList& pep_ids, Size& counter)
576  {
577  if (pep_ids.empty()) return;
578 
579  if (new_score_ == pep_ids[0].getScoreType()) // correct score already set
580  {
581  return;
582  }
583 
584  for (auto& id : pep_ids)
585  {
586  switchScores(id, counter);
587  }
588  }
589 
590 
600  {
601  // the score name, orientation and type used before the switch
603  bool original_score_higher_better = true;
605  // the score name, orientation and type used after the switch
606  bool requested_score_higher_better = original_score_higher_better;
607  IDScoreSwitcherAlgorithm::ScoreType requested_score_type = original_score_type;
608  String requested_score_name; // the search engine score name (e.g. "X!Tandem_score" or score category (e.g. "PEP")
609  // wheter the main score was switched
610  bool score_switched = false;
611  };
612 
626  static IDSwitchResult switchToScoreType(ConsensusMap& cmap, String requested_score_type_as_string, bool include_unassigned = true)
627  {
628  IDSwitchResult result;
629  // fill in the original score name, orientation and type
631  result.original_score_name,
633  result.original_score_type,
634  include_unassigned);
635 
636  // initalize with the assumption that the main score is the requested score
637  result.requested_score_name = result.original_score_name; // the search engine score name (e.g. "X!Tandem_score" or score category (e.g. "PEP")
640 
641  // no score type specified -> use main score
642  if (requested_score_type_as_string.empty())
643  {
644  OPENMS_LOG_DEBUG << "No score type specified. Using main score." << std::endl;
645  return result;
646  }
647 
648  // ENUM for requested score type (e.g. "RAW", "PEP", "q-value")
649  result.requested_score_type = IDScoreSwitcherAlgorithm::toScoreTypeEnum(requested_score_type_as_string);
650  if (result.requested_score_type != result.original_score_type) // switch needed because we change type?
651  { // user requests a different score type than the main score
654  auto param = idsa.getDefaults();
655  param.setValue("new_score", result.requested_score_name);
656  param.setValue("new_score_orientation", result.requested_score_higher_better ? "higher_better" : "lower_better");
657  param.setValue("proteins", "false");
658  param.setValue("old_score", ""); // use default name generated for old score
659  idsa.setParameters(param);
660 
661  Size counter = 0;
662  idsa.switchToGeneralScoreType(cmap, result.requested_score_type, counter, include_unassigned);
663  OPENMS_LOG_DEBUG << "Switched scores for " << counter << " IDs." << std::endl;
664  result.score_switched = true;
665  }
666 
667  // update after potential switch and read out actual score name
669  result.requested_score_name,
671  result.requested_score_type,
672  include_unassigned);
673 
674  return result;
675  }
676 
691  static IDSwitchResult switchToScoreType(PeptideIdentificationList& pep_ids, String requested_score_type_as_string)
692  {
693  IDSwitchResult result;
694  // fill in the original score name, orientation and type
696  result.original_score_name,
698  result.original_score_type
699  );
700 
701  // initalize with the assumption that the main score is the requested score
702  result.requested_score_name = result.original_score_name; // the search engine score name (e.g. "X!Tandem_score" or score category (e.g. "PEP")
705 
706  // no score type specified -> use main score
707  if (requested_score_type_as_string.empty())
708  {
709  OPENMS_LOG_DEBUG << "No score type specified. Using main score." << std::endl;
710  return result;
711  }
712 
713  // ENUM for requested score type (e.g. "RAW", "PEP", "q-value")
714  result.requested_score_type = IDScoreSwitcherAlgorithm::toScoreTypeEnum(requested_score_type_as_string);
715  if (result.requested_score_type != result.original_score_type) // switch needed because we change type?
716  { // user requests a different score type than the main score
719  auto param = idsa.getDefaults();
720  param.setValue("new_score", result.requested_score_name);
721  param.setValue("new_score_orientation", result.requested_score_higher_better ? "higher_better" : "lower_better");
722  param.setValue("proteins", "false");
723  param.setValue("old_score", ""); // use default name generated for old score
724  idsa.setParameters(param);
725  Size counter = 0;
726  idsa.switchToGeneralScoreType(pep_ids, result.requested_score_type, counter);
727  OPENMS_LOG_DEBUG << "Switched scores for " << counter << " IDs." << std::endl;
728 
729  result.score_switched = true;
730  }
731 
732  // update after potential switch and read out actual score name
734  result.requested_score_name,
736  result.requested_score_type
737  );
738 
739  return result;
740  }
741 
752  static void switchBackScoreType(ConsensusMap& cmap, IDSwitchResult isr, bool include_unassigned = true)
753  {
754  if (isr.score_switched)
755  {
756  // switch back to original score
758  auto param = idsa.getDefaults();
759  param.setValue("new_score", isr.original_score_name);
760  param.setValue("new_score_orientation", isr.original_score_higher_better ? "higher_better" : "lower_better");
761  param.setValue("proteins", "false");
762  param.setValue("old_score", ""); // use default name generated for old score
763  idsa.setParameters(param);
764  Size counter = 0;
765  idsa.switchScores(cmap, counter, include_unassigned);
766  OPENMS_LOG_DEBUG << "Switched scores back for " << counter << " PSMs." << std::endl;
767  }
768  }
769 
781  {
782  if (isr.score_switched)
783  {
784  // switch back to original score
786  auto param = idsa.getDefaults();
787  param.setValue("new_score", isr.original_score_name);
788  param.setValue("new_score_orientation", isr.original_score_higher_better ? "higher_better" : "lower_better");
789  param.setValue("proteins", "false");
790  param.setValue("old_score", ""); // use default name generated for old score
791  idsa.setParameters(param);
792  Size counter = 0;
793  idsa.switchScores(pep_ids, counter);
794  OPENMS_LOG_DEBUG << "Switched scores back for " << counter << " PSMs." << std::endl;
795  }
796  }
797 
798  private:
799 
800  void updateMembers_() override;
801 
803  const double tolerance_ = 1e-6;
804 
806  String new_score_, new_score_type_, old_score_;
807 
809  bool higher_better_; // for the new scores, are higher ones better?
810 
812  std::map<ScoreType, std::set<String>> type_to_str_ =
813  {
814  //TODO introduce real meaningful score names for XTandem, Mascot etc. (e.g., hyperscore)
815  {ScoreType::RAW, {"svm", "MS:1001492", "XTandem", "OMSSA", "SEQUEST:xcorr", "Mascot", "mvh", "hyperscore", "ln(hyperscore)"}},
816  //TODO find out reasonable raw scores for SES that provide E-Values as main score or see below
817  //TODO there is no test for spectraST idXML, so I don't know its score
818  //TODO check if we should combine RAW and RAW_EVAL:
819  // What if a SE does not have an e-value score (spectrast, OMSSA, crux/sequest, myrimatch),
820  // then you need additional if's/try's
821  {ScoreType::RAW_EVAL, {"expect", "SpecEValue", "E-Value", "evalue", "MS:1002053", "MS:1002257"}},
822  {ScoreType::PP, {"Posterior Probability"}},
823  {ScoreType::PEP, {"Posterior Error Probability", "pep", "PEP", "posterior_error_probability", "MS:1001493"}}, // TODO add CV terms
824  {ScoreType::FDR, {"FDR", "fdr", "false discovery rate"}},
825  {ScoreType::QVAL, {"q-value", "qvalue", "MS:1001491", "q-Value", "qval"}}
826  };
827 
829  std::map<ScoreType, bool> type_to_better_ =
830  {
831  {ScoreType::RAW, true}, //TODO this might actually not always be true
832  {ScoreType::RAW_EVAL, false},
833  {ScoreType::PP, true},
834  {ScoreType::PEP, false},
835  {ScoreType::FDR, false},
836  {ScoreType::QVAL, false}
837  };
838  };
839 } // namespace OpenMS
#define OPENMS_LOG_DEBUG
Macro for general debugging information.
Definition: LogStream.h:454
#define OPENMS_LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged.
Definition: LogStream.h:444
#define OPENMS_LOG_INFO
Macro if a information, e.g. a status should be reported.
Definition: LogStream.h:449
A container for consensus elements.
Definition: ConsensusMap.h:68
const PeptideIdentificationList & getUnassignedPeptideIdentifications() const
non-mutable access to the unassigned peptide identifications
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:33
bool isEmpty() const
Test if the value is empty.
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
void setParameters(const Param &param)
Sets the parameters.
const Param & getDefaults() const
Non-mutable access to the default parameters.
Not all required information provided.
Definition: Exception.h:155
bool empty() const noexcept
Definition: ExposedVector.h:140
const VecMember & getData() const
read-only access to the underlying data
Definition: ExposedVector.h:328
This class is used to switch identification scores within identification or consensus feature maps.
Definition: IDScoreSwitcherAlgorithm.h:42
void switchScores(PeptideIdentificationList &pep_ids, Size &counter)
Switches the scores of peptide identifications.
Definition: IDScoreSwitcherAlgorithm.h:575
bool score_switched
Definition: IDScoreSwitcherAlgorithm.h:610
bool requested_score_higher_better
the type of the original score
Definition: IDScoreSwitcherAlgorithm.h:606
IDScoreSwitcherAlgorithm::ScoreType original_score_type
whether a higher original score is better
Definition: IDScoreSwitcherAlgorithm.h:604
bool isScoreTypeHigherBetter(ScoreType score_type)
Determines whether a higher score type is better given a ScoreType enum.
Definition: IDScoreSwitcherAlgorithm.h:139
String score_name
Name of score to use (main score name if is_main_score_type=true, meta value name if found in meta va...
Definition: IDScoreSwitcherAlgorithm.h:157
void switchToGeneralScoreType(PeptideIdentificationList &pep_ids, ScoreType type, Size &counter)
Switches the score type of a PeptideIdentificationList to a general score type.
Definition: IDScoreSwitcherAlgorithm.h:358
void determineScoreNameOrientationAndType(const ConsensusMap &cmap, String &name, bool &higher_better, ScoreType &score_type, bool include_unassigned=true)
Determines the score type and orientation of the main score in a ConsensusMap.
Definition: IDScoreSwitcherAlgorithm.h:478
void switchToGeneralScoreType(ConsensusMap &cmap, ScoreType type, Size &counter, bool unassigned_peptides_too=true)
Switches the score type of a ConsensusMap to a general score type.
Definition: IDScoreSwitcherAlgorithm.h:377
IDScoreSwitcherAlgorithm::ScoreType requested_score_type
whether a higher requested score is better
Definition: IDScoreSwitcherAlgorithm.h:607
void switchScores(IDType &id, Size &counter)
Switches the main scores of all hits in an identification object based on the new scoring settings.
Definition: IDScoreSwitcherAlgorithm.h:238
static ScoreType toScoreTypeEnum(String score_type)
Converts a string representation of a score type to a ScoreType enum.
Definition: IDScoreSwitcherAlgorithm.h:98
bool is_main_score_type
True if the main score is already of the requested score type.
Definition: IDScoreSwitcherAlgorithm.h:156
std::vector< String > getScoreNames()
Gets a vector of all score names that are used in OpenMS.
bool isScoreType(const String &score_name, const ScoreType &type) const
Checks if the given score name corresponds to a specific score type.
Definition: IDScoreSwitcherAlgorithm.h:75
void switchScores(ConsensusMap &cmap, Size &counter, bool unassigned_peptides_too=true)
Switches the scores of peptide identifications in a ConsensusMap.
Definition: IDScoreSwitcherAlgorithm.h:542
String requested_score_name
the type of the requested score
Definition: IDScoreSwitcherAlgorithm.h:608
ScoreType
This is a rough hierarchy of possible score types in MS.
Definition: IDScoreSwitcherAlgorithm.h:55
@ RAW
Raw score, e.g., search engine specific scores like hyperscore.
void switchToGeneralScoreType(std::vector< IDType > &id, ScoreType type, Size &counter)
Switches the scoring type of identification objects to a general score type.
Definition: IDScoreSwitcherAlgorithm.h:304
void determineScoreNameOrientationAndType(const PeptideIdentificationList &pep_ids, String &name, bool &higher_better, ScoreType &score_type)
Determines the score type and orientation of the main score for a set of peptide identifications.
Definition: IDScoreSwitcherAlgorithm.h:438
bool original_score_higher_better
The name of the original score used before the switch.
Definition: IDScoreSwitcherAlgorithm.h:603
void updateMembers_() override
documented in base class
String original_score_name
Definition: IDScoreSwitcherAlgorithm.h:602
IDScoreSwitcherAlgorithm()
Default constructor. Initializes the parameter handler with default values.
static void switchBackScoreType(ConsensusMap &cmap, IDSwitchResult isr, bool include_unassigned=true)
Reverts the score type of a ConsensusMap to its original type based on the provided IDSwitchResult.
Definition: IDScoreSwitcherAlgorithm.h:752
ScoreSearchResult findScoreType(const IDType &id, ScoreType score_type) const
Searches for a general score type (e.g. PEP, QVAL) in an identification data structure.
Definition: IDScoreSwitcherAlgorithm.h:176
String new_score_
will be set according to the algorithm parameters
Definition: IDScoreSwitcherAlgorithm.h:806
static void switchBackScoreType(PeptideIdentificationList &pep_ids, IDSwitchResult isr)
Reverts the scoring type of peptide identifications to their original scores.
Definition: IDScoreSwitcherAlgorithm.h:780
static IDSwitchResult switchToScoreType(PeptideIdentificationList &pep_ids, String requested_score_type_as_string)
Switches the score type of peptide identifications to the requested type.
Definition: IDScoreSwitcherAlgorithm.h:691
static IDSwitchResult switchToScoreType(ConsensusMap &cmap, String requested_score_type_as_string, bool include_unassigned=true)
Switches the score type of a ConsensusMap to the requested score type.
Definition: IDScoreSwitcherAlgorithm.h:626
bool higher_better_
will be set according to the algorithm parameters
Definition: IDScoreSwitcherAlgorithm.h:809
Structure holding score switching information for IDScoreSwitcherAlgorithm.
Definition: IDScoreSwitcherAlgorithm.h:600
Structure to hold score detection results for any ScoreType.
Definition: IDScoreSwitcherAlgorithm.h:155
void applyFunctionOnPeptideIDs(T &&f, bool include_unassigned=true)
applies a function on all PeptideIDs or only assigned ones
Definition: MapUtilities.h:43
void setValue(const std::string &key, const ParamValue &value, const std::string &description="", const std::vector< std::string > &tags=std::vector< std::string >())
Sets a value.
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:63
A more convenient string class.
Definition: String.h:34
String chop(Size n) const
Returns a substring where n characters were removed from the end of the string.
String & toLower()
Converts the string to lowercase.
bool hasSuffix(const String &string) const
true if String ends with string, false otherwise
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
const double c
Definition: Constants.h:188
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19