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-2015.
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_),
86  {
87  }
88 
91  {
92  }
93 
95  {
96  if (&rhs != this)
97  {
98  tr_gr_id_ = rhs.tr_gr_id_;
106  }
107  return *this;
108  }
109 
110  inline Size size() const
111  {
112  return chromatograms_.size();
113  }
114 
115  inline const String & getTransitionGroupID() const
116  {
117  return tr_gr_id_;
118  }
119 
120  inline void setTransitionGroupID(const String & tr_gr_id)
121  {
122  tr_gr_id_ = tr_gr_id;
123  }
124 
125  inline const std::vector<TransitionType> & getTransitions() const
126  {
127  return transitions_;
128  }
129 
130  inline std::vector<TransitionType> & getTransitionsMuteable()
131  {
132  return transitions_;
133  }
134 
135  inline void addTransition(const TransitionType & transition, String key)
136  {
137  transitions_.push_back(transition);
138  transition_map_[key] = boost::numeric_cast<int>(transitions_.size()) - 1;
139  }
140 
141  inline const TransitionType & getTransition(String key)
142  {
143  return transitions_[transition_map_[key]];
144  }
145 
146  inline bool hasTransition(String key)
147  {
148  return transition_map_.find(key) != transition_map_.end();
149  }
150 
151  inline const std::vector<SpectrumType> & getChromatograms() const
152  {
153  return chromatograms_;
154  }
155 
156  inline std::vector<SpectrumType> & getChromatograms()
157  {
158  return chromatograms_;
159  }
160 
161  inline void addChromatogram(SpectrumType & chromatogram, String key)
162  {
163  chromatograms_.push_back(chromatogram);
164  chromatogram_map_[key] = boost::numeric_cast<int>(chromatograms_.size()) - 1;
165  }
166 
167  inline SpectrumType & getChromatogram(String key)
168  {
169  return chromatograms_[chromatogram_map_[key]];
170  }
171 
172  inline bool hasChromatogram(String key) const
173  {
174  return chromatogram_map_.find(key) != chromatogram_map_.end();
175  }
176 
187  inline void addPrecursorChromatogram(SpectrumType & chromatogram, String key)
188  {
189  precursor_chromatograms_.push_back(chromatogram);
190  precursor_chromatogram_map_[key] = boost::numeric_cast<int>(precursor_chromatograms_.size()) - 1;
191  }
192 
193  inline SpectrumType & getPrecursorChromatogram(String key)
194  {
196  }
197 
198  inline bool hasPrecursorChromatogram(String key) const
199  {
201  }
202 
203  inline const std::vector<MRMFeature> & getFeatures() const
204  {
205  return cons_features_;
206  }
207 
208  inline std::vector<MRMFeature> & getFeaturesMuteable()
209  {
210  return cons_features_;
211  }
212 
213  inline void addFeature(MRMFeature & feature)
214  {
215  cons_features_.push_back(feature);
216  }
217 
218  void getLibraryIntensity(std::vector<double> & result) const
219  {
220  for (typename TransitionsType::const_iterator it = transitions_.begin(); it != transitions_.end(); ++it)
221  {
222  result.push_back(it->getLibraryIntensity());
223  }
224  for (Size i = 0; i < result.size(); i++)
225  {
226  // the library intensity should never be below zero
227  if (result[i] < 0.0)
228  {
229  result[i] = 0.0;
230  }
231  }
232  }
233 
234 protected:
235 
238 
240  TransitionsType transitions_;
241 
243  std::vector<SpectrumType> chromatograms_;
244 
246  std::vector<SpectrumType> precursor_chromatograms_;
247 
249  MRMFeatureListType cons_features_;
250 
251  std::map<String, int> chromatogram_map_;
252  std::map<String, int> precursor_chromatogram_map_;
253  std::map<String, int> transition_map_;
254 
255  };
256 }
257 #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:253
TransitionsType transitions_
transition list
Definition: MRMTransitionGroup.h:240
const std::vector< TransitionType > & getTransitions() const
Definition: MRMTransitionGroup.h:125
String tr_gr_id_
transition group id (peak group id)
Definition: MRMTransitionGroup.h:237
A more convenient string class.
Definition: String.h:57
bool hasChromatogram(String key) const
Definition: MRMTransitionGroup.h:172
Size size() const
Definition: MRMTransitionGroup.h:110
std::map< String, int > chromatogram_map_
Definition: MRMTransitionGroup.h:251
const std::vector< MRMFeature > & getFeatures() const
Definition: MRMTransitionGroup.h:203
bool hasTransition(String key)
Definition: MRMTransitionGroup.h:146
const std::vector< SpectrumType > & getChromatograms() const
Definition: MRMTransitionGroup.h:151
SpectrumType & getPrecursorChromatogram(String key)
Definition: MRMTransitionGroup.h:193
Peak2D PeakType
Definition: MassTrace.h:48
void getLibraryIntensity(std::vector< double > &result) const
Definition: MRMTransitionGroup.h:218
MRMFeatureListType cons_features_
feature list
Definition: MRMTransitionGroup.h:249
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
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:94
std::vector< SpectrumType > precursor_chromatograms_
precursor chromatogram list
Definition: MRMTransitionGroup.h:246
std::vector< MRMFeature > MRMFeatureListType
Type definitions.
Definition: MRMTransitionGroup.h:64
void addChromatogram(SpectrumType &chromatogram, String key)
Definition: MRMTransitionGroup.h:161
std::vector< MRMFeature > & getFeaturesMuteable()
Definition: MRMTransitionGroup.h:208
void addPrecursorChromatogram(SpectrumType &chromatogram, String key)
Definition: MRMTransitionGroup.h:187
void addTransition(const TransitionType &transition, String key)
Definition: MRMTransitionGroup.h:135
void addFeature(MRMFeature &feature)
Definition: MRMTransitionGroup.h:213
std::vector< SpectrumType > chromatograms_
chromatogram list
Definition: MRMTransitionGroup.h:243
bool hasPrecursorChromatogram(String key) const
Definition: MRMTransitionGroup.h:198
void setTransitionGroupID(const String &tr_gr_id)
Definition: MRMTransitionGroup.h:120
SpectrumType & getChromatogram(String key)
Definition: MRMTransitionGroup.h:167
MRMTransitionGroup()
Constructor.
Definition: MRMTransitionGroup.h:72
std::vector< TransitionType > & getTransitionsMuteable()
Definition: MRMTransitionGroup.h:130
A multi-chromatogram MRM feature.
Definition: MRMFeature.h:50
const String & getTransitionGroupID() const
Definition: MRMTransitionGroup.h:115
std::vector< SpectrumType > & getChromatograms()
Definition: MRMTransitionGroup.h:156
virtual ~MRMTransitionGroup()
Destructor.
Definition: MRMTransitionGroup.h:90
const TransitionType & getTransition(String key)
Definition: MRMTransitionGroup.h:141
std::map< String, int > precursor_chromatogram_map_
Definition: MRMTransitionGroup.h:252

OpenMS / TOPP release 2.0.0 Documentation generated on Tue Aug 25 2015 05:53:49 using doxygen 1.8.9.1