OpenMS
Loading...
Searching...
No Matches
MassExplainer.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: Chris Bielow $
6// $Authors: Chris Bielow $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12
14
16#include <OpenMS/OpenMSConfig.h>
17
18namespace OpenMS
19{
20 class Compomer;
21
38 class OPENMS_DLLAPI MassExplainer
39 {
40
41public:
42
45
47 typedef std::vector<Compomer>::const_iterator CompomerIterator;
48
50
51
62
69
78 MassExplainer(Int q_min, Int q_max, Int max_span, double thresh_logp);
79
90 MassExplainer(AdductsType adduct_base, Int q_min, Int q_max, Int max_span, double thresh_logp, Size max_neutrals);
91
92
93private:
102 void init_(bool init_thresh_p);
103public:
111
113 virtual ~MassExplainer();
115
116
124 void compute();
125
126
127 //@name Accessors
129
135 void setAdductBase(AdductsType adduct_base);
136
143
153 const Compomer& getCompomerById(Size id) const;
155
156
172 SignedSize query(const Int net_charge,
173 const float mass_to_explain,
174 const float mass_delta,
175 const float thresh_log_p,
176 std::vector<Compomer>::const_iterator& firstExplanation,
177 std::vector<Compomer>::const_iterator& lastExplanation) const;
178protected:
179
186 bool compomerValid_(const Compomer& cmp) const;
187
196 Adduct createAdduct_(const String& formula, const Int charge, const double p) const;
197
199 std::vector<Compomer> explanations_;
200
203
206
209
212
214 double thresh_p_;
215
218
219 };
220
221
222} // namespace OpenMS
223
Definition Adduct.h:22
std::vector< Adduct > AdductsType
Definition Adduct.h:25
Holds information on an edge connecting two features from a (putative) charge ladder.
Definition Compomer.h:51
Computes empirical formulas for given mass differences using a set of allowed elements.
Definition MassExplainer.h:39
MassExplainer(AdductsType adduct_base)
Constructor with custom adduct base.
Adduct createAdduct_(const String &formula, const Int charge, const double p) const
Create a proper adduct from formula, charge, and probability.
Int q_max_
Maximum charge state to consider in explanations.
Definition MassExplainer.h:208
void compute()
Compute all possible mass differences and their explanations.
Int q_min_
Minimum charge state to consider in explanations.
Definition MassExplainer.h:205
SignedSize query(const Int net_charge, const float mass_to_explain, const float mass_delta, const float thresh_log_p, std::vector< Compomer >::const_iterator &firstExplanation, std::vector< Compomer >::const_iterator &lastExplanation) const
Search for explanations of a given mass difference.
AdductsType getAdductBase() const
Get the current set of allowed adducts.
const Compomer & getCompomerById(Size id) const
Get a specific compomer by its ID.
AdductsType adduct_base_
Set of allowed adducts that can be combined to explain mass differences.
Definition MassExplainer.h:202
void init_(bool init_thresh_p)
Check consistency of input parameters and initialize internal data structures.
MassExplainer(Int q_min, Int q_max, Int max_span, double thresh_logp)
Constructor with custom charge parameters.
MassExplainer(AdductsType adduct_base, Int q_min, Int q_max, Int max_span, double thresh_logp, Size max_neutrals)
Constructor with all custom parameters.
void setAdductBase(AdductsType adduct_base)
Set the base set of allowed adducts.
Size max_neutrals_
Maximum number of neutral (q=0) adducts allowed in an explanation.
Definition MassExplainer.h:217
double thresh_p_
Minimum required probability threshold for accepting explanations.
Definition MassExplainer.h:214
Int max_span_
Maximum allowed charge span between related features (e.g., a cluster with q={3,6} has span=4)
Definition MassExplainer.h:211
MassExplainer & operator=(const MassExplainer &rhs)
Assignment operator.
virtual ~MassExplainer()
Destructor.
MassExplainer()
Default constructor.
std::vector< Compomer > explanations_
Vector storing all possible explanations for mass differences.
Definition MassExplainer.h:199
bool compomerValid_(const Compomer &cmp) const
Check if a generated compomer is valid based on its probability, charges, etc.
Adduct::AdductsType AdductsType
Type definition for a vector of Adduct objects.
Definition MassExplainer.h:44
std::vector< Compomer >::const_iterator CompomerIterator
Type definition for an iterator over Compomer objects.
Definition MassExplainer.h:47
A more convenient string class.
Definition String.h:34
int Int
Signed integer type.
Definition Types.h:72
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition Types.h:104
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