OpenMS
Loading...
Searching...
No Matches
ScoredProcessingResult.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: Hendrik Weisser $
6// $Authors: Hendrik Weisser $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12#include <map>
13#include <optional>
14#include <tuple>
15#include <utility>
16
17namespace OpenMS
18{
19 namespace IdentificationDataInternal
20 {
22 struct OPENMS_DLLAPI ScoredProcessingResult: public MetaInfoInterface
23 {
25
27 AppliedProcessingSteps::OrderedView getStepsAndScoresByStep()
28 {
29 return steps_and_scores.get<1>();
30 }
31
33 AppliedProcessingSteps::ConstOrderedView getStepsAndScoresByStep() const
34 {
35 return steps_and_scores.get<1>();
36 }
37
44
47 const std::map<ScoreTypeRef, double>& scores =
48 std::map<ScoreTypeRef, double>());
49
51 void addScore(ScoreTypeRef score_type, double score,
52 const std::optional<ProcessingStepRef>&
53 processing_step_opt = std::nullopt);
54
57
65 std::pair<double, bool> getScore(ScoreTypeRef score_ref) const;
66
72 std::pair<double, bool> getScore(ScoreTypeRef score_ref,
73 std::optional<ProcessingStepRef>
74 processing_step_opt) const;
75
83 std::tuple<double, std::optional<ProcessingStepRef>, bool>
84 getScoreAndStep(ScoreTypeRef score_ref) const;
85
93 std::tuple<double, std::optional<ScoreTypeRef>, bool>
95
98
99 protected:
102 const AppliedProcessingSteps& steps_and_scores =
104 steps_and_scores(steps_and_scores)
105 {
106 }
107
110 };
111
112 }
113}
OrderedView get()
Definition IDDataContainer.h:312
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition MetaInfoInterface.h:35
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Wrapper that adds operator< to iterators, so they can be used as (part of) keys in maps/sets or multi...
Definition MetaData.h:20
Base class for ID data with scores and processing steps (and meta info)
Definition ScoredProcessingResult.h:23
AppliedProcessingSteps::ConstOrderedView getStepsAndScoresByStep() const
Return the applied processing steps (incl. scores) as a set ordered by processing step reference (opt...
Definition ScoredProcessingResult.h:33
void addProcessingStep(const AppliedProcessingStep &step)
Add an applied processing step.
std::pair< double, bool > getScore(ScoreTypeRef score_ref, std::optional< ProcessingStepRef > processing_step_opt) const
Look up a score by score type and processing step.
AppliedProcessingSteps steps_and_scores
Definition ScoredProcessingResult.h:24
std::tuple< double, std::optional< ScoreTypeRef >, bool > getMostRecentScore() const
Get the (primary) score from the most recent processing step.
Size getNumberOfScores() const
Return the number of scores associated with this result.
std::tuple< double, std::optional< ProcessingStepRef >, bool > getScoreAndStep(ScoreTypeRef score_ref) const
Look up a score and associated processing step by score type.
ScoredProcessingResult(const AppliedProcessingSteps &steps_and_scores=AppliedProcessingSteps())
Constructor.
Definition ScoredProcessingResult.h:101
void addScore(ScoreTypeRef score_type, double score, const std::optional< ProcessingStepRef > &processing_step_opt=std::nullopt)
Add a score (possibly connected to a processing step)
ScoredProcessingResult & merge(const ScoredProcessingResult &other)
Merge in data from another object.
std::pair< double, bool > getScore(ScoreTypeRef score_ref) const
Look up a score by score type.
void addProcessingStep(ProcessingStepRef step_ref, const std::map< ScoreTypeRef, double > &scores=std::map< ScoreTypeRef, double >())
Add a processing step (and associated scores, if any)
ScoredProcessingResult(const ScoredProcessingResult &)=default
Copy c'tor.
AppliedProcessingSteps::OrderedView getStepsAndScoresByStep()
Return the applied processing steps (incl. scores) as a set ordered by processing step reference (opt...
Definition ScoredProcessingResult.h:27