OpenMS
Loading...
Searching...
No Matches
IsoSpecWrapper.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 Rost $
6// $Authors: Hannes Rost, Michał Startek, Mateusz Łącki $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11#include <vector>
12#include <memory>
13
16
18
21
22
23// forward declarations
24namespace IsoSpec
25{
26class IsoLayeredGenerator;
27class IsoThresholdGenerator;
28class IsoOrderedGenerator;
29}
30
31namespace OpenMS
32{
61 class OPENMS_DLLAPI IsoSpecGeneratorWrapper
62 {
63
64public:
65
76 virtual bool nextConf() = 0;
77
85 virtual Peak1D getConf() = 0;
86
94 virtual double getMass() = 0;
95
103 virtual double getIntensity() = 0;
104
115 virtual double getLogIntensity() = 0;
116
120 virtual ~IsoSpecGeneratorWrapper() = default;
121 };
122
128 class OPENMS_DLLAPI IsoSpecWrapper
129 {
130public:
153
154 virtual inline ~IsoSpecWrapper() = default;
155 };
156
157 //--------------------------------------------------------------------------
158 // IsoSpecGeneratorWrapper classes
159 //--------------------------------------------------------------------------
160
188 {
189public:
203 IsoSpecTotalProbGeneratorWrapper(const std::vector<int>& isotopeNumbers,
204 const std::vector<int>& atomCounts,
205 const std::vector<std::vector<double> >& isotopeMasses,
206 const std::vector<std::vector<double> >& isotopeProbabilities,
207 double p);
208
216
218
219 bool nextConf() final;
220 Peak1D getConf() final;
221 double getMass() final;
222 double getIntensity() final;
223 double getLogIntensity() final;
224
225protected:
226 std::unique_ptr<IsoSpec::IsoLayeredGenerator> ILG;
227 };
228
251 {
252
253public:
268 IsoSpecThresholdGeneratorWrapper(const std::vector<int>& isotopeNumbers,
269 const std::vector<int>& atomCounts,
270 const std::vector<std::vector<double> >& isotopeMasses,
271 const std::vector<std::vector<double> >& isotopeProbabilities,
272 double threshold,
273 bool absolute);
274
275 // delete copy constructor
277
282 IsoSpecThresholdGeneratorWrapper(const EmpiricalFormula& formula, double threshold, bool absolute);
283
285
286 bool nextConf() final;
287 Peak1D getConf() final;
288 double getMass() final;
289 double getIntensity() final;
290 double getLogIntensity() final;
291
292
293protected:
294 std::unique_ptr<IsoSpec::IsoThresholdGenerator> ITG;
295 };
296
315 {
316public:
326 IsoSpecOrderedGeneratorWrapper(const std::vector<int>& isotopeNumbers,
327 const std::vector<int>& atomCounts,
328 const std::vector<std::vector<double> >& isotopeMasses,
329 const std::vector<std::vector<double> >& isotopeProbabilities);
330
331 // delete copy constructor
338
340
341 inline bool nextConf() final;
342 inline Peak1D getConf() final;
343 inline double getMass() final;
344 inline double getIntensity() final;
345 inline double getLogIntensity() final;
346
347protected:
348 std::unique_ptr<IsoSpec::IsoOrderedGenerator> IOG;
349 };
350
351 //--------------------------------------------------------------------------
352 // IsoSpecWrapper classes
353 //--------------------------------------------------------------------------
354
376 class OPENMS_DLLAPI IsoSpecTotalProbWrapper : public IsoSpecWrapper
377 {
378public:
393 IsoSpecTotalProbWrapper(const std::vector<int>& isotopeNumbers,
394 const std::vector<int>& atomCounts,
395 const std::vector<std::vector<double> >& isotopeMasses,
396 const std::vector<std::vector<double> >& isotopeProbabilities,
397 double p,
398 bool do_p_trim = false);
399
400 // delete copy constructor
402
407 IsoSpecTotalProbWrapper(const EmpiricalFormula& formula, double p, bool do_p_trim = false);
408
410
412
413protected:
414 std::unique_ptr<IsoSpec::IsoLayeredGenerator> ILG;
415 const double target_prob;
416 const bool do_p_trim;
417 };
418
439 class OPENMS_DLLAPI IsoSpecThresholdWrapper : public IsoSpecWrapper
440 {
441
442public:
457 IsoSpecThresholdWrapper(const std::vector<int>& isotopeNumbers,
458 const std::vector<int>& atomCounts,
459 const std::vector<std::vector<double> >& isotopeMasses,
460 const std::vector<std::vector<double> >& isotopeProbabilities,
461 double threshold,
462 bool absolute);
463
464 // delelte copy constructor
470 IsoSpecThresholdWrapper(const EmpiricalFormula& formula, double threshold, bool absolute);
471
473
475
476protected:
477 std::unique_ptr<IsoSpec::IsoThresholdGenerator> ITG;
478
479 };
480
481}
482
Representation of an empirical formula.
Definition EmpiricalFormula.h:62
Interface for the IsoSpec algorithm - a generator of infinitely-resolved theoretical spectra.
Definition IsoSpecWrapper.h:62
virtual Peak1D getConf()=0
Obtain the current isotopologue.
virtual bool nextConf()=0
Move the generator to a next isotopologue.
virtual ~IsoSpecGeneratorWrapper()=default
Destructor.
virtual double getIntensity()=0
Obtain the intensity (probability, relative peak height) of the current configuration.
virtual double getLogIntensity()=0
Obtain the natural logarithm of the intensity (probability, relative peak height) of the current conf...
virtual double getMass()=0
Obtain the mass of the current isotopologue.
Generate the stream of configurations, ordered from most likely to least likely.
Definition IsoSpecWrapper.h:315
bool nextConf() final
Move the generator to a next isotopologue.
IsoSpecOrderedGeneratorWrapper(const EmpiricalFormula &formula)
Setup the algorithm to run on an EmpiricalFormula.
IsoSpecOrderedGeneratorWrapper(const IsoSpecOrderedGeneratorWrapper &)=delete
IsoSpecOrderedGeneratorWrapper(const std::vector< int > &isotopeNumbers, const std::vector< int > &atomCounts, const std::vector< std::vector< double > > &isotopeMasses, const std::vector< std::vector< double > > &isotopeProbabilities)
Constructor.
Provides a threshold-based generator of isotopologues: generates all isotopologues more probable than...
Definition IsoSpecWrapper.h:251
IsoSpecThresholdGeneratorWrapper(const std::vector< int > &isotopeNumbers, const std::vector< int > &atomCounts, const std::vector< std::vector< double > > &isotopeMasses, const std::vector< std::vector< double > > &isotopeProbabilities, double threshold, bool absolute)
Constructor.
IsoSpecThresholdGeneratorWrapper(const IsoSpecThresholdGeneratorWrapper &)=delete
bool nextConf() final
Move the generator to a next isotopologue.
IsoSpecThresholdGeneratorWrapper(const EmpiricalFormula &formula, double threshold, bool absolute)
Setup the algorithm to run on an EmpiricalFormula.
A non-generator version of IsoSpecThresholdGeneratorWrapper.
Definition IsoSpecWrapper.h:440
IsoSpecThresholdWrapper(const std::vector< int > &isotopeNumbers, const std::vector< int > &atomCounts, const std::vector< std::vector< double > > &isotopeMasses, const std::vector< std::vector< double > > &isotopeProbabilities, double threshold, bool absolute)
Constructor.
IsotopeDistribution run() final
Run the algorithm.
IsoSpecThresholdWrapper(const EmpiricalFormula &formula, double threshold, bool absolute)
Setup the algorithm to run on an EmpiricalFormula.
IsoSpecThresholdWrapper(const IsoSpecThresholdWrapper &)=delete
Generate a p-set of configurations for a given p (that is, a set of configurations such that their pr...
Definition IsoSpecWrapper.h:188
IsoSpecTotalProbGeneratorWrapper(const IsoSpecTotalProbGeneratorWrapper &)=delete
delete copy constructor
IsoSpecTotalProbGeneratorWrapper(const EmpiricalFormula &formula, double p)
Setup the algorithm to run on an EmpiricalFormula.
bool nextConf() final
Move the generator to a next isotopologue.
IsoSpecTotalProbGeneratorWrapper(const std::vector< int > &isotopeNumbers, const std::vector< int > &atomCounts, const std::vector< std::vector< double > > &isotopeMasses, const std::vector< std::vector< double > > &isotopeProbabilities, double p)
Constructor.
Create a p-set of configurations for a given p (that is, a set of configurations such that their prob...
Definition IsoSpecWrapper.h:377
IsoSpecTotalProbWrapper(const IsoSpecTotalProbWrapper &)=delete
IsotopeDistribution run() final
Run the algorithm.
IsoSpecTotalProbWrapper(const EmpiricalFormula &formula, double p, bool do_p_trim=false)
Setup the algorithm to run on an EmpiricalFormula.
IsoSpecTotalProbWrapper(const std::vector< int > &isotopeNumbers, const std::vector< int > &atomCounts, const std::vector< std::vector< double > > &isotopeMasses, const std::vector< std::vector< double > > &isotopeProbabilities, double p, bool do_p_trim=false)
Constructor.
A convenience class for the IsoSpec algorithm - easier to use than the IsoSpecGeneratorWrapper classe...
Definition IsoSpecWrapper.h:129
virtual IsotopeDistribution run()=0
Run the algorithm.
virtual ~IsoSpecWrapper()=default
Definition IsotopeDistribution.h:40
A 1-dimensional raw data point or peak.
Definition Peak1D.h:30
Definition IsoSpecWrapper.h:25
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
STL namespace.