OpenMS
Loading...
Searching...
No Matches
Scores.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
13#include <OpenMS/OpenMSConfig.h>
14
15#include <vector>
16#include <set>
17#include <map>
18#include <algorithm>
19
20namespace OpenMS
21{
22
40 class OPENMS_DLLAPI Scores
41 {
42 public:
50 enum class IDType
51 {
52 RAW,
53 RAW_EVAL,
54 PP,
55 PEP,
56 FDR,
57 QVAL,
58 };
59
71 static bool isScoreType(const String& score_name, IDType type);
72
85 static IDType parseIDType(const String& score_type);
86
93 static bool isHigherBetter(IDType type);
94
100 static std::vector<String> getAllIDScoreNames();
101
108 static const std::set<String>& getIDNamesForType(IDType type);
109
119 static bool findIDTypeByName(const String& name, IDType& type);
120
130 static String normalizeScoreName(const String& score_name);
131
142 static bool isKnownScoreType(const String& score_name);
143
144 private:
146 struct Maps_
147 {
148 std::map<IDType, std::set<String>> type_to_str;
149 std::map<IDType, bool> type_to_better;
150 };
151
153 static const Maps_& getMaps_();
154 };
155
156} // namespace OpenMS
Utility class for score type handling in identification and quantification workflows.
Definition Scores.h:41
static std::vector< String > getAllIDScoreNames()
Gets a vector of all ID score names that are used in OpenMS.
std::map< IDType, std::set< String > > type_to_str
Definition Scores.h:148
static bool isScoreType(const String &score_name, IDType type)
Checks if the given score name corresponds to a specific ID score type.
IDType
Hierarchy of possible score types in MS identification.
Definition Scores.h:51
static bool findIDTypeByName(const String &name, IDType &type)
Finds the ID score type for a given score name.
static IDType parseIDType(const String &score_type)
Converts a string representation of an ID score type to an IDType enum.
static bool isKnownScoreType(const String &score_name)
Checks if a score name is a known score type (after normalization).
static bool isHigherBetter(IDType type)
Determines whether a higher score is better for the given ID score type.
std::map< IDType, bool > type_to_better
Definition Scores.h:149
static const std::set< String > & getIDNamesForType(IDType type)
Gets the set of known names for a specific ID score type.
static const Maps_ & getMaps_()
Returns the singleton Maps_ instance (thread-safe initialization guaranteed by C++11)
static String normalizeScoreName(const String &score_name)
Normalizes a score name by removing the "_score" suffix if present.
Holds the static score type lookup maps (thread-safe via C++11 function-local static)
Definition Scores.h:147
A more convenient string class.
Definition String.h:34
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19