OpenMS
AdductInfo.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Erhan Kenar, Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 
14 namespace OpenMS
15 {
16  class OPENMS_DLLAPI AdductInfo
17  {
18  public:
28  AdductInfo(const String& name, const EmpiricalFormula& adduct, int charge, UInt mol_multiplier = 1);
29 
31  double getNeutralMass(double observed_mz) const;
32 
34  double getMZ(double neutral_mass) const;
35 
37  double getMassShift(bool use_avg_mass = false) const;
38 
41  bool isCompatible(const EmpiricalFormula& db_entry) const;
42 
44  int getCharge() const;
45 
47  const String& getName() const;
48 
51 
54 
58  static AdductInfo parseAdductString(const String& adduct);
59 
61  bool operator==(const AdductInfo& other) const;
62 
63  private:
67  double mass_;
68  int charge_;
70  };
71 }
Definition: AdductInfo.h:17
double getMassShift(bool use_avg_mass=false) const
returns the mass shift caused by this adduct if charges are compensated with protons
AdductInfo(const String &name, const EmpiricalFormula &adduct, int charge, UInt mol_multiplier=1)
double mass_
computed from ef_.getMonoWeight(), but stored explicitly for efficiency
Definition: AdductInfo.h:67
EmpiricalFormula ef_
Sum formula for the actual adduct e.g. 'H' in 2M+H;+1.
Definition: AdductInfo.h:66
const EmpiricalFormula & getEmpiricalFormula() const
sum formula of adduct itself. Useful for comparison with feature adduct annotation
String name_
members
Definition: AdductInfo.h:65
UInt getMolMultiplier() const
get molecular multiplier
bool operator==(const AdductInfo &other) const
equality operator
double getNeutralMass(double observed_mz) const
returns the neutral mass of the small molecule without adduct (creates monomer from nmer,...
int getCharge() const
get charge of adduct
static AdductInfo parseAdductString(const String &adduct)
UInt mol_multiplier_
Mol multiplier, e.g. 2 in 2M+H;+1.
Definition: AdductInfo.h:69
int charge_
negative or positive charge; must not be 0
Definition: AdductInfo.h:68
const String & getName() const
original string used for parsing
bool isCompatible(const EmpiricalFormula &db_entry) const
double getMZ(double neutral_mass) const
returns the m/z of the small molecule with neutral mass neutral_mass if the adduct is added (given ma...
Representation of an empirical formula.
Definition: EmpiricalFormula.h:59
A more convenient string class.
Definition: String.h:34
unsigned int UInt
Unsigned integer type.
Definition: Types.h:68
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22