OpenMS
ChargePair.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-2023.
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: Chris Bielow $
32 // $Authors: $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
38 #include <OpenMS/CONCEPT/Types.h>
39 #include <OpenMS/OpenMSConfig.h>
40 
41 #include <iosfwd>
42 #include <vector>
43 
44 namespace OpenMS
45 {
46 
57  class OPENMS_DLLAPI ChargePair
58  {
59 
60 public:
62 
63  ChargePair();
65 
67  ChargePair(const Size& index0,
68  const Size& index1,
69  const Int& charge0,
70  const Int& charge1,
71  const Compomer& compomer,
72  const double& mass_diff,
73  const bool active);
74 
76  ChargePair(const ChargePair& rhs);
77 
80 
82  virtual ~ChargePair() = default;
83 
85 
86  //@name Accessors
88  Int getCharge(UInt pairID) const;
90 
92  void setCharge(UInt pairID, Int e);
93 
95  Size getElementIndex(UInt pairID) const;
96 
98  void setElementIndex(UInt pairID, Size e);
99 
101  const Compomer& getCompomer() const;
102 
104  void setCompomer(const Compomer& compomer);
105 
107  double getMassDiff() const;
108 
110  void setMassDiff(double mass_diff);
111 
113  double getEdgeScore() const;
114 
116  void setEdgeScore(double score);
117 
119  bool isActive() const;
120 
121  void setActive(const bool active);
122 
124 
126  virtual bool operator==(const ChargePair& i) const;
127 
129  virtual bool operator!=(const ChargePair& i) const;
130 
131 protected:
132 
144  double mass_diff_;
146  double score_;
149  };
150 
152  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const ChargePair& cons);
153 
154 } // namespace OpenMS
155 
Representation of a (putative) link between two Features, which stem from the same compound but have ...
Definition: ChargePair.h:58
const Compomer & getCompomer() const
Returns the Id of the compomer that explains the mass difference.
double mass_diff_
mass difference (after explanation by compomer)
Definition: ChargePair.h:144
virtual bool operator==(const ChargePair &i) const
Equality operator.
bool isActive() const
is this pair realized?
void setCompomer(const Compomer &compomer)
Set the compomer id.
void setMassDiff(double mass_diff)
Sets the mass difference.
double getMassDiff() const
Returns the mass difference.
ChargePair(const ChargePair &rhs)
Copy constructor.
virtual ~ChargePair()=default
Destructor.
Size getElementIndex(UInt pairID) const
Returns the element index (for element 0 or 1)
Size feature1_index_
Int of the second element within the FeatureMap.
Definition: ChargePair.h:136
bool is_active_
was this pair realized by ILP?
Definition: ChargePair.h:148
Size feature0_index_
Int of the first element within the FeatureMap.
Definition: ChargePair.h:134
void setActive(const bool active)
Compomer compomer_
Compomer that explains the mass difference.
Definition: ChargePair.h:142
ChargePair & operator=(const ChargePair &rhs)
Assignment operator.
ChargePair(const Size &index0, const Size &index1, const Int &charge0, const Int &charge1, const Compomer &compomer, const double &mass_diff, const bool active)
Constructor from map index, element index and Feature.
void setCharge(UInt pairID, Int e)
Set the charge (for element 0 or 1)
virtual bool operator!=(const ChargePair &i) const
Equality operator.
void setElementIndex(UInt pairID, Size e)
Set the element index (for element 0 or 1)
Int feature0_charge_
Assumed charge of the first feature.
Definition: ChargePair.h:138
double getEdgeScore() const
Returns the ILP edge score.
void setEdgeScore(double score)
Sets the ILP edge score.
Int feature1_charge_
Assumed charge of the second feature.
Definition: ChargePair.h:140
double score_
Score of this edge used in ILP.
Definition: ChargePair.h:146
Holds information on an edge connecting two features from a (putative) charge ladder.
Definition: Compomer.h:59
int Int
Signed integer type.
Definition: Types.h:102
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)