Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
MRMTransitionGroup.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: Hannes Roest $
32 // $Authors: Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_KERNEL_MRMTRANSITIONGROUP_H
36 #define OPENMS_KERNEL_MRMTRANSITIONGROUP_H
37 
39 #include <boost/numeric/conversion/cast.hpp>
40 
41 namespace OpenMS
42 {
55  template <typename SpectrumType, typename TransitionType>
57  {
58 
59 public:
60 
62 
63  typedef std::vector<MRMFeature> MRMFeatureListType;
66  typedef std::vector<TransitionType> TransitionsType;
68  typedef typename SpectrumType::PeakType PeakType;
70 
73  {
74  }
75 
78  tr_gr_id_(rhs.tr_gr_id_),
84  {
85  }
86 
89  {
90  }
91 
93  {
94  if (&rhs != this)
95  {
96  tr_gr_id_ = rhs.tr_gr_id_;
100 
103  }
104  return *this;
105  }
106 
107  inline Size size() const
108  {
109  return chromatograms_.size();
110  }
111 
112  inline const String & getTransitionGroupID() const
113  {
114  return tr_gr_id_;
115  }
116 
117  inline void setTransitionGroupID(const String & tr_gr_id)
118  {
119  tr_gr_id_ = tr_gr_id;
120  }
121 
122  inline const std::vector<TransitionType> & getTransitions() const
123  {
124  return transitions_;
125  }
126 
127  inline std::vector<TransitionType> & getTransitionsMuteable()
128  {
129  return transitions_;
130  }
131 
132  inline void addTransition(const TransitionType & transition, String key)
133  {
134  transitions_.push_back(transition);
135  transition_map_[key] = boost::numeric_cast<int>(transitions_.size()) - 1;
136  }
137 
138  inline const TransitionType & getTransition(String key)
139  {
140  return transitions_[transition_map_[key]];
141  }
142 
143  inline bool hasTransition(String key)
144  {
145  return transition_map_.find(key) != transition_map_.end();
146  }
147 
148  inline const std::vector<SpectrumType> & getChromatograms() const
149  {
150  return chromatograms_;
151  }
152 
153  inline std::vector<SpectrumType> & getChromatograms()
154  {
155  return chromatograms_;
156  }
157 
158  inline void addChromatogram(SpectrumType & chromatogram, String key)
159  {
160  chromatograms_.push_back(chromatogram);
161  chromatogram_map_[key] = boost::numeric_cast<int>(chromatograms_.size()) - 1;
162  }
163 
164  inline SpectrumType & getChromatogram(String key)
165  {
166  return chromatograms_[chromatogram_map_[key]];
167  }
168 
169  inline bool hasChromatogram(String key)
170  {
171  return chromatogram_map_.find(key) != chromatogram_map_.end();
172  }
173 
174  inline const std::vector<MRMFeature> & getFeatures() const
175  {
176  return cons_features_;
177  }
178 
179  inline std::vector<MRMFeature> & getFeaturesMuteable()
180  {
181  return cons_features_;
182  }
183 
184  inline void addFeature(MRMFeature & feature)
185  {
186  cons_features_.push_back(feature);
187  }
188 
189  void getLibraryIntensity(std::vector<double> & result) const
190  {
191  for (typename TransitionsType::const_iterator it = transitions_.begin(); it != transitions_.end(); ++it)
192  {
193  result.push_back(it->getLibraryIntensity());
194  }
195  for (Size i = 0; i < result.size(); i++)
196  {
197  // the library intensity should never be below zero
198  if (result[i] < 0.0)
199  {
200  result[i] = 0.0;
201  }
202  }
203  }
204 
205 protected:
206 
209 
212 
214  std::vector<SpectrumType> chromatograms_;
215 
218 
219  std::map<String, int> chromatogram_map_;
220  std::map<String, int> transition_map_;
221 
222  };
223 }
224 #endif
std::vector< TransitionType > TransitionsType
List of Reaction Monitoring transitions (meta data) type.
Definition: MRMTransitionGroup.h:66
MRMTransitionGroup(const MRMTransitionGroup &rhs)
Copy Constructor.
Definition: MRMTransitionGroup.h:77
std::map< String, int > transition_map_
Definition: MRMTransitionGroup.h:220
TransitionsType transitions_
transition list
Definition: MRMTransitionGroup.h:211
const std::vector< TransitionType > & getTransitions() const
Definition: MRMTransitionGroup.h:122
String tr_gr_id_
transition group id (peak group id)
Definition: MRMTransitionGroup.h:208
A more convenient string class.
Definition: String.h:56
Size size() const
Definition: MRMTransitionGroup.h:107
std::map< String, int > chromatogram_map_
Definition: MRMTransitionGroup.h:219
const std::vector< MRMFeature > & getFeatures() const
Definition: MRMTransitionGroup.h:174
bool hasTransition(String key)
Definition: MRMTransitionGroup.h:143
const std::vector< SpectrumType > & getChromatograms() const
Definition: MRMTransitionGroup.h:148
Peak2D PeakType
Definition: MassTrace.h:49
void getLibraryIntensity(std::vector< double > &result) const
Definition: MRMTransitionGroup.h:189
MRMFeatureListType cons_features_
feature list
Definition: MRMTransitionGroup.h:217
SpectrumType::PeakType PeakType
Peak type.
Definition: MRMTransitionGroup.h:68
The representation of a transition group that has information about the individual chromatograms as w...
Definition: MRMTransitionGroup.h:56
MRMTransitionGroup & operator=(const MRMTransitionGroup &rhs)
Definition: MRMTransitionGroup.h:92
std::vector< MRMFeature > MRMFeatureListType
Type definitions.
Definition: MRMTransitionGroup.h:64
void addChromatogram(SpectrumType &chromatogram, String key)
Definition: MRMTransitionGroup.h:158
std::vector< MRMFeature > & getFeaturesMuteable()
Definition: MRMTransitionGroup.h:179
void addTransition(const TransitionType &transition, String key)
Definition: MRMTransitionGroup.h:132
void addFeature(MRMFeature &feature)
Definition: MRMTransitionGroup.h:184
std::vector< SpectrumType > chromatograms_
chromatogram list
Definition: MRMTransitionGroup.h:214
void setTransitionGroupID(const String &tr_gr_id)
Definition: MRMTransitionGroup.h:117
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
SpectrumType & getChromatogram(String key)
Definition: MRMTransitionGroup.h:164
MRMTransitionGroup()
Constructor.
Definition: MRMTransitionGroup.h:72
std::vector< TransitionType > & getTransitionsMuteable()
Definition: MRMTransitionGroup.h:127
bool hasChromatogram(String key)
Definition: MRMTransitionGroup.h:169
A multi-chromatogram MRM feature.
Definition: MRMFeature.h:50
const String & getTransitionGroupID() const
Definition: MRMTransitionGroup.h:112
std::vector< SpectrumType > & getChromatograms()
Definition: MRMTransitionGroup.h:153
virtual ~MRMTransitionGroup()
Destructor.
Definition: MRMTransitionGroup.h:88
const TransitionType & getTransition(String key)
Definition: MRMTransitionGroup.h:138

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