OpenMS
Loading...
Searching...
No Matches
IncludeExcludeTarget.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: Hannes Roest $
6// $Authors: Andreas Bertsch $
7// --------------------------------------------------------------------------
8
9#pragma once
10
15
16#include <functional>
17#include <vector>
18
19namespace OpenMS
20{
28 class OPENMS_DLLAPI IncludeExcludeTarget :
29 public CVTermList
30 {
31
32public:
33
36
42
45
49
52
56 void setName(const String & name);
57
58 const String & getName() const;
59
60 void setPeptideRef(const String & peptide_ref);
61
62 const String & getPeptideRef() const;
63
64 void setCompoundRef(const String & compound_ref);
65
66 const String & getCompoundRef() const;
67
69 void setPrecursorMZ(double mz);
70
71 double getPrecursorMZ() const;
72
74
75 void addPrecursorCVTerm(const CVTerm & cv_term);
76
78
79 void setProductMZ(double mz);
80
81 double getProductMZ() const;
82
83 void setProductCVTermList(const CVTermList & list);
84
85 void addProductCVTerm(const CVTerm & cv_term);
86
88
89 void setInterpretations(const std::vector<CVTermList> & interpretations);
90
91 const std::vector<CVTermList> & getInterpretations() const;
92
93 void addInterpretation(const CVTermList & interpretation);
94
95 void setConfigurations(const std::vector<Configuration> & configuration);
96
97 const std::vector<Configuration> & getConfigurations() const;
98
99 void addConfiguration(const Configuration & configuration);
100
101 void setPrediction(const CVTermList & prediction);
102
103 void addPredictionTerm(const CVTerm & prediction);
104
105 const CVTermList & getPrediction() const;
106
108
111
116 bool operator==(const IncludeExcludeTarget & rhs) const;
117
119 bool operator!=(const IncludeExcludeTarget & rhs) const;
121
122protected:
123
125
127
129
131
133
135
136 std::vector<CVTermList> interpretation_list_;
137
139
141
142 std::vector<Configuration> configurations_;
143
145
147
148 };
149} // namespace OpenMS
150
151namespace std
152{
154 template <>
155 struct hash<OpenMS::IncludeExcludeTarget>
156 {
157 std::size_t operator()(const OpenMS::IncludeExcludeTarget& t) const noexcept
158 {
159 std::size_t seed = 0;
160
161 // Hash CVTermList base class
163
164 // Hash name_
166
167 // Hash precursor_mz_ and precursor_cv_terms_
168 OpenMS::hash_combine(seed, OpenMS::hash_float(t.getPrecursorMZ()));
169 OpenMS::hash_combine(seed, OpenMS::hashCVTermList(t.getPrecursorCVTermList()));
170
171 // Hash product_mz_ and product_cv_terms_
172 OpenMS::hash_combine(seed, OpenMS::hash_float(t.getProductMZ()));
173 OpenMS::hash_combine(seed, OpenMS::hashCVTermList(t.getProductCVTermList()));
174
175 // Hash interpretation_list_
176 for (const auto& interp : t.getInterpretations())
177 {
179 }
180
181 // Hash peptide_ref_ and compound_ref_
182 OpenMS::hash_combine(seed, OpenMS::fnv1a_hash_string(t.getPeptideRef()));
183 OpenMS::hash_combine(seed, OpenMS::fnv1a_hash_string(t.getCompoundRef()));
184
185 // Hash configurations_
186 for (const auto& config : t.getConfigurations())
187 {
188 OpenMS::hash_combine(seed, OpenMS::fnv1a_hash_string(config.contact_ref));
189 OpenMS::hash_combine(seed, OpenMS::fnv1a_hash_string(config.instrument_ref));
191 for (const auto& validation : config.validations)
192 {
194 }
195 }
196
197 // Hash prediction_
198 OpenMS::hash_combine(seed, OpenMS::hashCVTermList(t.getPrediction()));
199
200 // Hash rts_ (RetentionTime)
201 const auto& rt = t.getRetentionTime();
202 OpenMS::hash_combine(seed, OpenMS::fnv1a_hash_string(rt.software_ref));
203 OpenMS::hash_combine(seed, OpenMS::hash_int(static_cast<int>(rt.retention_time_unit)));
204 OpenMS::hash_combine(seed, OpenMS::hash_int(static_cast<int>(rt.retention_time_type)));
205 OpenMS::hash_combine(seed, OpenMS::hash_int(rt.isRTset() ? 1 : 0));
206 if (rt.isRTset())
207 {
208 OpenMS::hash_combine(seed, OpenMS::hash_float(rt.getRT()));
209 }
211
212 return seed;
213 }
214 };
215} // namespace std
216
Representation of controlled vocabulary term list.
Definition CVTermList.h:29
Representation of controlled vocabulary term.
Definition CVTerm.h:28
This class stores a SRM/MRM transition.
Definition IncludeExcludeTarget.h:30
CVTermList product_cv_terms_
Definition IncludeExcludeTarget.h:134
std::vector< Configuration > configurations_
Definition IncludeExcludeTarget.h:142
void setPeptideRef(const String &peptide_ref)
void addConfiguration(const Configuration &configuration)
std::vector< CVTermList > interpretation_list_
Definition IncludeExcludeTarget.h:136
const CVTermList & getProductCVTermList() const
IncludeExcludeTarget()
default constructor
const String & getCompoundRef() const
String name_
Definition IncludeExcludeTarget.h:126
bool operator!=(const IncludeExcludeTarget &rhs) const
inequality operator
String peptide_ref_
Definition IncludeExcludeTarget.h:138
String compound_ref_
Definition IncludeExcludeTarget.h:140
void addProductCVTerm(const CVTerm &cv_term)
void setCompoundRef(const String &compound_ref)
const std::vector< Configuration > & getConfigurations() const
void setInterpretations(const std::vector< CVTermList > &interpretations)
RetentionTime rts_
Definition IncludeExcludeTarget.h:146
const RetentionTime & getRetentionTime() const
const CVTermList & getPrecursorCVTermList() const
TargetedExperimentHelper::Configuration Configuration
Definition IncludeExcludeTarget.h:34
bool operator==(const IncludeExcludeTarget &rhs) const
equality operator
void setPrecursorCVTermList(const CVTermList &list)
void setName(const String &name)
~IncludeExcludeTarget() override
destructor
IncludeExcludeTarget(const IncludeExcludeTarget &rhs)
copy constructor
const String & getName() const
double precursor_mz_
Definition IncludeExcludeTarget.h:128
const String & getPeptideRef() const
void setProductCVTermList(const CVTermList &list)
const CVTermList & getPrediction() const
void setConfigurations(const std::vector< Configuration > &configuration)
void setPrediction(const CVTermList &prediction)
CVTermList precursor_cv_terms_
Definition IncludeExcludeTarget.h:130
void addInterpretation(const CVTermList &interpretation)
void setRetentionTime(RetentionTime rt)
const std::vector< CVTermList > & getInterpretations() const
void addPredictionTerm(const CVTerm &prediction)
void setProductMZ(double mz)
void addPrecursorCVTerm(const CVTerm &cv_term)
TargetedExperimentHelper::RetentionTime RetentionTime
Definition IncludeExcludeTarget.h:35
CVTermList prediction_
Definition IncludeExcludeTarget.h:144
IncludeExcludeTarget & operator=(const IncludeExcludeTarget &rhs)
assignment operator
void setPrecursorMZ(double mz)
sets the precursor mz (Q1 value)
double product_mz_
Definition IncludeExcludeTarget.h:132
A more convenient string class.
Definition String.h:34
This class stores a retention time structure that is used in TargetedExperiment (representing a TraML...
Definition TargetedExperimentHelper.h:101
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::size_t hashCVTermList(const CVTermList &cvtl) noexcept
Definition TargetedExperimentHelper.h:657
std::size_t hash_int(T value) noexcept
Hash for an integer type.
Definition HashUtils.h:107
void hash_combine(std::size_t &seed, std::size_t value) noexcept
Combine a hash value with additional data using golden ratio mixing.
Definition HashUtils.h:87
std::size_t hash_float(T value) noexcept
Hash for a floating point type (float or double).
Definition HashUtils.h:142
std::size_t fnv1a_hash_string(const std::string &s) noexcept
FNV-1a hash for a string.
Definition HashUtils.h:70
std::size_t hashCVTermListInterface(const CVTermListInterface &cvtli) noexcept
Definition TargetedExperimentHelper.h:658
STL namespace.
Definition TargetedExperimentHelper.h:41
std::size_t operator()(const OpenMS::IncludeExcludeTarget &t) const noexcept
Definition IncludeExcludeTarget.h:157