OpenMS  3.0.0
IsoSpecWrapper.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2022.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Hannes Rost $
32 // $Authors: Hannes Rost, Michał Startek, Mateusz Łącki $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <vector>
38 #include <memory>
39 
40 #include <OpenMS/CONCEPT/Types.h>
43 
44 #include <OpenMS/KERNEL/Peak1D.h>
45 
48 
49 
50 // forward declarations
51 namespace IsoSpec
52 {
53 class IsoLayeredGenerator;
54 class IsoThresholdGenerator;
55 class IsoOrderedGenerator;
56 }
57 
58 namespace OpenMS
59 {
88  class OPENMS_DLLAPI IsoSpecGeneratorWrapper
89  {
90 
91 public:
92 
103  virtual bool nextConf() = 0;
104 
112  virtual Peak1D getConf() = 0;
113 
121  virtual double getMass() = 0;
122 
130  virtual double getIntensity() = 0;
131 
142  virtual double getLogIntensity() = 0;
143 
147  virtual ~IsoSpecGeneratorWrapper() = default;
148  };
149 
155  class OPENMS_DLLAPI IsoSpecWrapper
156  {
157 public:
179  virtual IsotopeDistribution run() = 0;
180 
181  virtual inline ~IsoSpecWrapper() = default;
182  };
183 
184  //--------------------------------------------------------------------------
185  // IsoSpecGeneratorWrapper classes
186  //--------------------------------------------------------------------------
187 
215  {
216 public:
230  IsoSpecTotalProbGeneratorWrapper(const std::vector<int>& isotopeNumbers,
231  const std::vector<int>& atomCounts,
232  const std::vector<std::vector<double> >& isotopeMasses,
233  const std::vector<std::vector<double> >& isotopeProbabilities,
234  double p);
235 
242  IsoSpecTotalProbGeneratorWrapper(const EmpiricalFormula& formula, double p);
243 
245 
246  bool nextConf() final;
247  Peak1D getConf() final;
248  double getMass() final;
249  double getIntensity() final;
250  double getLogIntensity() final;
251 
252 protected:
253  std::unique_ptr<IsoSpec::IsoLayeredGenerator> ILG;
254  };
255 
278  {
279 
280 public:
295  IsoSpecThresholdGeneratorWrapper(const std::vector<int>& isotopeNumbers,
296  const std::vector<int>& atomCounts,
297  const std::vector<std::vector<double> >& isotopeMasses,
298  const std::vector<std::vector<double> >& isotopeProbabilities,
299  double threshold,
300  bool absolute);
301 
302  // delete copy constructor
304 
309  IsoSpecThresholdGeneratorWrapper(const EmpiricalFormula& formula, double threshold, bool absolute);
310 
312 
313  bool nextConf() final;
314  Peak1D getConf() final;
315  double getMass() final;
316  double getIntensity() final;
317  double getLogIntensity() final;
318 
319 
320 protected:
321  std::unique_ptr<IsoSpec::IsoThresholdGenerator> ITG;
322  };
323 
342  {
343 public:
353  IsoSpecOrderedGeneratorWrapper(const std::vector<int>& isotopeNumbers,
354  const std::vector<int>& atomCounts,
355  const std::vector<std::vector<double> >& isotopeMasses,
356  const std::vector<std::vector<double> >& isotopeProbabilities);
357 
358  // delete copy constructor
365 
367 
368  inline bool nextConf() final;
369  inline Peak1D getConf() final;
370  inline double getMass() final;
371  inline double getIntensity() final;
372  inline double getLogIntensity() final;
373 
374 protected:
375  std::unique_ptr<IsoSpec::IsoOrderedGenerator> IOG;
376  };
377 
378  //--------------------------------------------------------------------------
379  // IsoSpecWrapper classes
380  //--------------------------------------------------------------------------
381 
403  class OPENMS_DLLAPI IsoSpecTotalProbWrapper : public IsoSpecWrapper
404  {
405 public:
420  IsoSpecTotalProbWrapper(const std::vector<int>& isotopeNumbers,
421  const std::vector<int>& atomCounts,
422  const std::vector<std::vector<double> >& isotopeMasses,
423  const std::vector<std::vector<double> >& isotopeProbabilities,
424  double p,
425  bool do_p_trim = false);
426 
427  // delete copy constructor
429 
434  IsoSpecTotalProbWrapper(const EmpiricalFormula& formula, double p, bool do_p_trim = false);
435 
437 
438  IsotopeDistribution run() final;
439 
440 protected:
441  std::unique_ptr<IsoSpec::IsoLayeredGenerator> ILG;
442  const double target_prob;
443  const bool do_p_trim;
444  };
445 
466  class OPENMS_DLLAPI IsoSpecThresholdWrapper : public IsoSpecWrapper
467  {
468 
469 public:
484  IsoSpecThresholdWrapper(const std::vector<int>& isotopeNumbers,
485  const std::vector<int>& atomCounts,
486  const std::vector<std::vector<double> >& isotopeMasses,
487  const std::vector<std::vector<double> >& isotopeProbabilities,
488  double threshold,
489  bool absolute);
490 
491  // delelte copy constructor
497  IsoSpecThresholdWrapper(const EmpiricalFormula& formula, double threshold, bool absolute);
498 
500 
501  IsotopeDistribution run() final;
502 
503 protected:
504  std::unique_ptr<IsoSpec::IsoThresholdGenerator> ITG;
505 
506  };
507 
508 }
509 
OpenMS::IsoSpecOrderedGeneratorWrapper::IOG
std::unique_ptr< IsoSpec::IsoOrderedGenerator > IOG
Definition: IsoSpecWrapper.h:375
Types.h
Peak1D.h
OpenMS::IsoSpecThresholdGeneratorWrapper::ITG
std::unique_ptr< IsoSpec::IsoThresholdGenerator > ITG
Definition: IsoSpecWrapper.h:321
OpenMS::IsoSpecWrapper
A convenience class for the IsoSpec algorithm - easier to use than the IsoSpecGeneratorWrapper classe...
Definition: IsoSpecWrapper.h:155
OpenMS::IsoSpecThresholdWrapper
A non-generator version of IsoSpecThresholdGeneratorWrapper.
Definition: IsoSpecWrapper.h:466
Constants.h
OpenMS::IsoSpecThresholdGeneratorWrapper
Provides a threshold-based generator of isotopologues: generates all isotopologues more probable than...
Definition: IsoSpecWrapper.h:277
OpenMS::IsoSpecTotalProbGeneratorWrapper
Generate a p-set of configurations for a given p (that is, a set of configurations such that their pr...
Definition: IsoSpecWrapper.h:214
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::IsoSpecTotalProbWrapper::ILG
std::unique_ptr< IsoSpec::IsoLayeredGenerator > ILG
Definition: IsoSpecWrapper.h:441
Exception.h
IsotopeDistribution.h
OpenMS::IsoSpecTotalProbWrapper::do_p_trim
const bool do_p_trim
Definition: IsoSpecWrapper.h:443
OpenMS::IsoSpecThresholdWrapper::ITG
std::unique_ptr< IsoSpec::IsoThresholdGenerator > ITG
Definition: IsoSpecWrapper.h:504
OpenMS::Peak1D
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:53
EmpiricalFormula.h
OpenMS::IsotopeDistribution
Definition: IsotopeDistribution.h:64
IsoSpec
Definition: IsoSpecWrapper.h:51
OpenMS::IsoSpecTotalProbGeneratorWrapper::ILG
std::unique_ptr< IsoSpec::IsoLayeredGenerator > ILG
Definition: IsoSpecWrapper.h:253
OpenMS::EmpiricalFormula
Representation of an empirical formula.
Definition: EmpiricalFormula.h:84
OpenMS::IsoSpecOrderedGeneratorWrapper
Generate the stream of configurations, ordered from most likely to least likely.
Definition: IsoSpecWrapper.h:341
OpenMS::IsoSpecGeneratorWrapper
Interface for the IsoSpec algorithm - a generator of infinitely-resolved theoretical spectra.
Definition: IsoSpecWrapper.h:88
OpenMS::IsoSpecTotalProbWrapper
Create a p-set of configurations for a given p (that is, a set of configurations such that their prob...
Definition: IsoSpecWrapper.h:403
OpenMS::IsoSpecTotalProbWrapper::target_prob
const double target_prob
Definition: IsoSpecWrapper.h:442