OpenMS
Loading...
Searching...
No Matches
AppliedProcessingStep.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
15
16
17#include <optional>
18
19namespace OpenMS
20{
21 namespace IdentificationDataInternal
22 {
27 {
33 std::optional<ProcessingStepRef> processing_step_opt;
34
36 std::map<ScoreTypeRef, double> scores;
37
40 const std::optional<ProcessingStepRef>& processing_step_opt =
41 std::nullopt, const std::map<ScoreTypeRef, double>& scores =
42 std::map<ScoreTypeRef, double>()):
44 {
45 }
46
48 bool operator==(const AppliedProcessingStep& other) const
49 {
50 return ((processing_step_opt == other.processing_step_opt) &&
51 (scores == other.scores));
52 }
53
62 std::vector<std::pair<ScoreTypeRef, double>>
63 getScoresInOrder(bool primary_only = false) const
64 {
65 std::vector<std::pair<ScoreTypeRef, double>> result;
66 std::set<ScoreTypeRef> scores_done;
67
69 {
70 ProcessingSoftwareRef sw_ref = (*processing_step_opt)->software_ref;
71 for (ScoreTypeRef score_ref : sw_ref->assigned_scores)
72 {
73 auto pos = scores.find(score_ref);
74 if (pos != scores.end())
75 {
76 result.push_back(*pos);
77 if (primary_only) return result;
78 scores_done.insert(score_ref);
79 }
80 }
81 }
82 for (const auto& pair: scores)
83 {
84 if (!scores_done.contains(pair.first))
85 {
86 result.push_back(pair);
87 if (primary_only) return result;
88 }
89 }
90 return result;
91 }
92 };
93
94 // we want to keep track of the processing steps in sequence (order of
95 // application), but also ensure there are no duplicate steps:
97 }
98}
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::map< ScoreTypeRef, double > scores
Map of scores and their types.
Definition AppliedProcessingStep.h:36
bool operator==(const AppliedProcessingStep &other) const
Equality operator (needed for multi-index container)
Definition AppliedProcessingStep.h:48
std::optional< ProcessingStepRef > processing_step_opt
(Optional) reference to the processing step
Definition AppliedProcessingStep.h:33
std::vector< std::pair< ScoreTypeRef, double > > getScoresInOrder(bool primary_only=false) const
Return scores in order of priority (primary first).
Definition AppliedProcessingStep.h:63
AppliedProcessingStep(const std::optional< ProcessingStepRef > &processing_step_opt=std::nullopt, const std::map< ScoreTypeRef, double > &scores=std::map< ScoreTypeRef, double >())
Constructor.
Definition AppliedProcessingStep.h:39