Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
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-2013.
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 #ifndef OPENMS_DATASTRUCTURES_CHARGEPAIR_H
36 #define OPENMS_DATASTRUCTURES_CHARGEPAIR_H
37 
38 #include <iostream>
39 #include <vector>
40 
43 
44 namespace OpenMS
45 {
46 
57  class OPENMS_DLLAPI ChargePair
58  {
59 
60 public:
62 
63  ChargePair() :
65  feature0_index_(0),
66  feature1_index_(0),
67  feature0_charge_(0),
68  feature1_charge_(0),
69  compomer_(),
70  mass_diff_(0),
71  score_(1),
72  is_active_(false)
73  {
74  }
75 
77  ChargePair(const Size & index0,
78  const Size & index1,
79  const Int & charge0,
80  const Int & charge1,
81  const Compomer & compomer,
82  const DoubleReal & mass_diff,
83  const bool active) :
84  feature0_index_(index0),
85  feature1_index_(index1),
86  feature0_charge_(charge0),
87  feature1_charge_(charge1),
88  compomer_(compomer),
89  mass_diff_(mass_diff),
90  score_(1),
91  is_active_(active)
92  {
93  }
94 
96  ChargePair(const ChargePair & rhs) :
97  feature0_index_(rhs.feature0_index_),
98  feature1_index_(rhs.feature1_index_),
99  feature0_charge_(rhs.feature0_charge_),
100  feature1_charge_(rhs.feature1_charge_),
101  compomer_(rhs.compomer_),
102  mass_diff_(rhs.mass_diff_),
103  score_(rhs.score_),
104  is_active_(rhs.is_active_)
105  {
106  }
107 
110  {
111  if (&rhs == this) return *this;
112 
113  feature0_index_ = rhs.feature0_index_;
114  feature1_index_ = rhs.feature1_index_;
115  feature0_charge_ = rhs.feature0_charge_;
116  feature1_charge_ = rhs.feature1_charge_;
117  compomer_ = rhs.compomer_;
118  mass_diff_ = rhs.mass_diff_;
119  score_ = rhs.score_;
120  is_active_ = rhs.is_active_;
121 
122  return *this;
123  }
124 
126  virtual ~ChargePair()
127  {
128  }
129 
131 
132  //@name Accessors
134  Int getCharge(UInt pairID) const
136  {
137  if (pairID == 0) return feature0_charge_;
138  else return feature1_charge_;
139  }
140 
142  void setCharge(UInt pairID, Int e)
143  {
144  if (pairID == 0) feature0_charge_ = e;
145  else feature1_charge_ = e;
146  }
147 
149  Size getElementIndex(UInt pairID) const
150  {
151  if (pairID == 0) return feature0_index_;
152  else return feature1_index_;
153  }
154 
156  void setElementIndex(UInt pairID, Size e)
157  {
158  if (pairID == 0) feature0_index_ = e;
159  else feature1_index_ = e;
160  }
161 
163  const Compomer & getCompomer() const
164  {
165  return compomer_;
166  }
167 
169  void setCompomer(const Compomer & compomer)
170  {
171  compomer_ = compomer;
172  }
173 
176  {
177  return mass_diff_;
178  }
179 
181  void setMassDiff(DoubleReal mass_diff)
182  {
183  mass_diff_ = mass_diff;
184  }
185 
188  {
189  return score_;
190  }
191 
194  {
195  score_ = score;
196  }
197 
199  bool isActive() const
200  {
201  return is_active_;
202  }
203 
204  void setActive(const bool active)
205  {
206  is_active_ = active;
207  }
208 
210 
212  virtual bool operator==(const ChargePair & i) const
213  {
214  return (feature0_index_ == i.feature0_index_) &&
215  (feature1_index_ == i.feature1_index_) &&
216  (feature0_charge_ == i.feature0_charge_) &&
217  (feature1_charge_ == i.feature1_charge_) &&
218  (compomer_ == i.compomer_) &&
219  (mass_diff_ == i.mass_diff_) &&
220  (is_active_ == i.is_active_);
221  }
222 
224  virtual bool operator!=(const ChargePair & i) const
225  {
226  return !(this->operator==(i));
227  }
228 
229 protected:
230 
247  };
248 
250  OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const ChargePair & cons);
251 
252 } // namespace OpenMS
253 
254 #endif // OPENMS_DATASTRUCTURES_CHARGEPAIR_H
bool is_active_
was this pair realized by ILP?
Definition: ChargePair.h:246
void setMassDiff(DoubleReal mass_diff)
Sets the mass difference.
Definition: ChargePair.h:181
DoubleReal getMassDiff() const
Returns the mass difference.
Definition: ChargePair.h:175
Size feature1_index_
Int of the second element within the FeatureMap.
Definition: ChargePair.h:234
void setCharge(UInt pairID, Int e)
Set the charge (for element 0 or 1)
Definition: ChargePair.h:142
std::ostream & operator<<(std::ostream &os, const ItraqQuantifier::ItraqQuantifierStats &stats)
Holds information on an edge connecting two features from a (putative) charge ladder.
Definition: Compomer.h:58
ChargePair(const Size &index0, const Size &index1, const Int &charge0, const Int &charge1, const Compomer &compomer, const DoubleReal &mass_diff, const bool active)
Constructor from map index, element index and Feature.
Definition: ChargePair.h:77
Representation of a (putative) link between two Features, which stem from the same compound but have ...
Definition: ChargePair.h:57
const Compomer & getCompomer() const
Returns the Id of the compomer that explains the mass difference.
Definition: ChargePair.h:163
Compomer compomer_
Compomer that explains the mass difference.
Definition: ChargePair.h:240
DoubleReal getEdgeScore() const
Returns the ILP edge score.
Definition: ChargePair.h:187
void setCompomer(const Compomer &compomer)
Set the compomer id.
Definition: ChargePair.h:169
bool isActive() const
is this pair realized?
Definition: ChargePair.h:199
void setActive(const bool active)
Definition: ChargePair.h:204
DoubleReal score_
Score of this edge used in ILP.
Definition: ChargePair.h:244
DoubleReal mass_diff_
mass difference (after explanation by compomer)
Definition: ChargePair.h:242
virtual bool operator!=(const ChargePair &i) const
Equality operator.
Definition: ChargePair.h:224
virtual bool operator==(const ChargePair &i) const
Equality operator.
Definition: ChargePair.h:212
Size getElementIndex(UInt pairID) const
Returns the element index (for element 0 or 1)
Definition: ChargePair.h:149
void setElementIndex(UInt pairID, Size e)
Set the element index (for element 0 or 1)
Definition: ChargePair.h:156
void setEdgeScore(DoubleReal score)
Sets the ILP edge score.
Definition: ChargePair.h:193
Int feature1_charge_
Assumed charge of the second feature.
Definition: ChargePair.h:238
Size feature0_index_
Int of the first element within the FeatureMap.
Definition: ChargePair.h:232
ChargePair & operator=(const ChargePair &rhs)
Assignment operator.
Definition: ChargePair.h:109
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
Int feature0_charge_
Assumed charge of the first feature.
Definition: ChargePair.h:236
virtual ~ChargePair()
Destructor.
Definition: ChargePair.h:126
ChargePair(const ChargePair &rhs)
Copy constructor.
Definition: ChargePair.h:96
int Int
Signed integer type.
Definition: Types.h:100

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:11 using doxygen 1.8.5