OpenMS
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Compomer.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 
11 #include <OpenMS/CONCEPT/Types.h>
13 #include <OpenMS/OpenMSConfig.h>
14 
15 #include <map>
16 #include <vector>
17 
18 namespace OpenMS
19 {
20 
21  class Adduct;
22  class String;
23 
48  class OPENMS_DLLAPI Compomer
49  {
50 public:
58  enum SIDE {LEFT, RIGHT, BOTH};
59 
61  typedef std::map<String, Adduct> CompomerSide;
62 
70  typedef std::vector<CompomerSide> CompomerComponents;
71 
78 
86  Compomer(Int net_charge, double mass, double log_p);
87 
93  Compomer(const Compomer& p);
94 
101  Compomer& operator=(const Compomer& source);
102 
112  void add(const Adduct& a, UInt side);
113 
125  bool isConflicting(const Compomer& cmp, UInt side_this, UInt side_other) const;
126 
132  void setID(const Size& id);
133 
139  const Size& getID() const;
140 
147 
155  const Int& getNetCharge() const;
156 
162  const double& getMass() const;
163 
169  const Int& getPositiveCharges() const;
170 
176  const Int& getNegativeCharges() const;
177 
185  const double& getLogP() const;
186 
192  const double& getRTShift() const;
193 
200 
208 
216  bool isSingleAdduct(Adduct& a, const UInt side) const;
217 
224  Compomer removeAdduct(const Adduct& a) const;
225 
232  Compomer removeAdduct(const Adduct& a, const UInt side) const;
233 
240  StringList getLabels(const UInt side) const;
241 
242 
249  void add(const CompomerSide& add_side, UInt side);
250 
263  friend OPENMS_DLLAPI bool operator<(const Compomer& c1, const Compomer& c2);
264 
272  friend OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Compomer& cmp);
273 
281  friend OPENMS_DLLAPI bool operator==(const Compomer& a, const Compomer& b);
282 
283 private:
284 
287  double mass_;
290  double log_p_;
291  double rt_shift_;
293 
294  }; // \Compomer
295 
296 } // namespace OpenMS
297 
Definition: Adduct.h:19
Holds information on an edge connecting two features from a (putative) charge ladder.
Definition: Compomer.h:49
Compomer & operator=(const Compomer &source)
Assignment Operator.
bool isConflicting(const Compomer &cmp, UInt side_this, UInt side_other) const
Determines if two compomers conflict with each other.
StringList getLabels(const UInt side) const
Returns the adduct labels from side (LEFT or RIGHT)
const CompomerComponents & getComponent() const
Get both sides (left and right) of this compomer.
double mass_
Net mass (right - left)
Definition: Compomer.h:287
std::map< String, Adduct > CompomerSide
Type definition for one side of a compomer (maps adduct labels to Adduct objects)
Definition: Compomer.h:61
double log_p_
Log probability of this adduct combination.
Definition: Compomer.h:290
Compomer(const Compomer &p)
Copy constructor.
const double & getLogP() const
Get the log probability of this adduct combination.
void add(const Adduct &a, UInt side)
Add an adduct to a specific side of the compomer.
CompomerComponents cmp_
Adducts of left and right side.
Definition: Compomer.h:285
Int neg_charges_
Sum of negative charges.
Definition: Compomer.h:289
Compomer removeAdduct(const Adduct &a) const
Remove all adducts of type a.
Compomer(Int net_charge, double mass, double log_p)
Constructor with net-charge, mass, and probability.
const double & getMass() const
Get the total mass difference represented by this compomer.
String getAdductsAsString() const
Get a string representation of all adducts in this compomer.
const Int & getNegativeCharges() const
Get the sum of negative charges in this compomer.
friend bool operator==(const Compomer &a, const Compomer &b)
Equality comparison operator.
bool isSingleAdduct(Adduct &a, const UInt side) const
Check if the compomer contains only a single adduct on the specified side.
const Size & getID() const
Get the unique identifier of this compomer.
Int pos_charges_
Sum of positive charges.
Definition: Compomer.h:288
friend std::ostream & operator<<(std::ostream &os, const Compomer &cmp)
Output stream operator for printing compomer contents.
double rt_shift_
Expected net RT shift (-shift_leftside + shift_rightside)
Definition: Compomer.h:291
String getAdductsAsString(UInt side) const
Get a string representation of adducts on a specific side.
Int net_charge_
Net charge (right - left)
Definition: Compomer.h:286
void add(const CompomerSide &add_side, UInt side)
Add a complete set of adducts to a specific side of the compomer.
const Int & getPositiveCharges() const
Get the sum of positive charges in this compomer.
Compomer removeAdduct(const Adduct &a, const UInt side) const
Remove all adducts of type a from side (LEFT or RIGHT)
const Int & getNetCharge() const
Get the net charge of this compomer.
std::vector< CompomerSide > CompomerComponents
Container for both sides of a compomer.
Definition: Compomer.h:70
friend bool operator<(const Compomer &c1, const Compomer &c2)
Comparison operator for sorting compomers.
void setID(const Size &id)
Set a unique identifier for this compomer.
Size id_
Unique identifier for this compomer.
Definition: Compomer.h:292
SIDE
Enumeration for specifying which side of the compomer to operate on.
Definition: Compomer.h:58
Compomer()
Default Constructor.
const double & getRTShift() const
Get the expected retention time shift caused by this compomer.
A more convenient string class.
Definition: String.h:34
int Int
Signed integer type.
Definition: Types.h:72
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
@ BOTH
combine COMPACT and ONE_BY_ONE