Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
LayerData.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: Timo Sachsenberg $
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_VISUAL_LAYERDATA_H
36 #define OPENMS_VISUAL_LAYERDATA_H
37 
38 // OpenMS_GUI config
40 
48 
49 #include <boost/shared_ptr.hpp>
50 
51 #include <vector>
52 #include <bitset>
53 
54 namespace OpenMS
55 {
61  class LayerData
62  {
63 public:
66  enum DataType
68  {
75  };
76 
78  enum Flags
79  {
88  };
89 
91  std::bitset<SIZE_OF_FLAGS> flags;
92 
94  enum LabelType
95  {
99  L_ID,
102  };
103 
105  static const std::string NamesOfLabelType[SIZE_OF_LABEL_TYPE];
106 
109 
111  typedef boost::shared_ptr<FeatureMap > FeatureMapSharedPtrType;
112 
115 
117  typedef boost::shared_ptr<ConsensusMap> ConsensusMapSharedPtrType;
118 
121 
123  typedef boost::shared_ptr<ExperimentType> ExperimentSharedPtrType;
124 
126 
129  flags(),
130  visible(true),
131  flipped(false),
132  type(DT_UNKNOWN),
133  name(),
134  filename(),
135  peptides(),
136  param(),
137  gradient(),
138  filters(),
139  annotations_1d(),
140  modifiable(false),
141  modified(false),
142  label(L_NONE),
143  features(new FeatureMapType()),
145  peaks(new ExperimentType()),
148  {
149  annotations_1d.resize(1);
150  }
151 
154 
157  {
158  return features;
159  }
160 
163  {
164  return features;
165  }
166 
169  {
170  return consensus;
171  }
172 
175  {
176  return consensus;
177  }
178 
181  {
182  return peaks;
183  }
184 
187  {
188  return peaks;
189  }
190 
193  {
194  return chromatograms;
195  }
196 
199  {
200  return chromatograms;
201  }
202 
205  {
207  }
208 
211  {
213  }
214 
216  const Annotations1DContainer & getAnnotations(Size spectrum_index) const
217  {
218  return annotations_1d[spectrum_index];
219  }
220 
223  {
224  return annotations_1d[spectrum_index];
225  }
226 
229  {
230  return (*peaks)[current_spectrum_];
231  }
232 
235  {
236  return current_spectrum_;
237  }
238 
241  {
242  current_spectrum_ = index;
243  }
244 
246  // we need this specifically because this->type will *not* distinguish
247  // chromatogram and spectra data since we need to store chromatograms for
248  // the 1D case in a layer that looks like PEAK data to all tools.
250  {
251  return this->getPeakData()->size() > 0 &&
252  this->getPeakData()->metaValueExists("is_chromatogram") &&
253  this->getPeakData()->getMetaValue("is_chromatogram").toBool();
254  }
255 
256  // set the chromatogram flag
258  {
259  this->getPeakData()->setMetaValue("is_chromatogram", "true");
260  }
261 
262  // remove the chromatogram flag
264  {
265  if (this->chromatogram_flag_set())
266  {
267  this->getPeakData()->removeMetaValue("is_chromatogram");
268  }
269  }
270 
272  bool visible;
273 
275  bool flipped;
276 
279 
282 
285 
287  std::vector<PeptideIdentification> peptides;
288 
291 
294 
297 
299  std::vector<Annotations1DContainer> annotations_1d;
300 
303 
305  bool modified;
306 
309 
310 private:
313 
316 
319 
322 
325  };
326 
328  OPENMS_GUI_DLLAPI std::ostream & operator<<(std::ostream & os, const LayerData & rhs);
329 
330 } //namespace
331 
332 #endif
Flags
Flags that determine which information is shown.
Definition: LayerData.h:78
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:111
Consensus features: Show elements.
Definition: LayerData.h:85
static const std::string NamesOfLabelType[SIZE_OF_LABEL_TYPE]
Label names.
Definition: LayerData.h:105
Features: Convex hulls of single mass traces.
Definition: LayerData.h:81
MSSpectrum< PeakType > SpectrumType
Spectrum Type.
Definition: MSExperiment.h:91
FeatureMapSharedPtrType features
feature data
Definition: LayerData.h:312
const Annotations1DContainer & getCurrentAnnotations() const
Returns a const reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:204
std::bitset< SIZE_OF_FLAGS > flags
Actual state of each flag.
Definition: LayerData.h:91
Features: Overall convex hull.
Definition: LayerData.h:80
Definition: LayerData.h:87
A more convenient string class.
Definition: String.h:57
LabelType label
Label type.
Definition: LayerData.h:308
const ConsensusMapSharedPtrType & getConsensusMap() const
Returns a const reference to the consensus feature data.
Definition: LayerData.h:168
const FeatureMapSharedPtrType & getFeatureMap() const
Returns a const reference to the current feature data.
Definition: LayerData.h:156
DataType
Dataset types.
Definition: LayerData.h:67
bool modified
Flag that indicates that the layer data was modified since loading it.
Definition: LayerData.h:305
A container for features.
Definition: FeatureMap.h:93
FeatureMapSharedPtrType & getFeatureMap()
Returns a const reference to the current feature data.
Definition: LayerData.h:162
void remove_chromatogram_flag()
Definition: LayerData.h:263
ExperimentType::SpectrumType & getCurrentSpectrum()
Returns a mutable reference to the current spectrum (1d view)
Definition: LayerData.h:228
MSExperiment ExperimentType
Main data type (experiment)
Definition: LayerData.h:120
All peptide hits of the first identification run are used.
Definition: LayerData.h:100
Size getCurrentSpectrumIndex() const
Get the index of the current spectrum.
Definition: LayerData.h:234
A container for consensus elements.
Definition: ConsensusMap.h:72
Undefined data type indicating an error.
Definition: LayerData.h:74
Peptide identification data.
Definition: LayerData.h:73
Annotations1DContainer & getCurrentAnnotations()
Returns a mutable reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:210
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:123
Chromatogram data.
Definition: LayerData.h:72
std::vector< Annotations1DContainer > annotations_1d
Annotations of all spectra of the experiment (1D view)
Definition: LayerData.h:299
ExperimentSharedPtrType & getPeakData()
Returns a mutable reference to the current peak data.
Definition: LayerData.h:186
The &#39;label&#39; meta information is used.
Definition: LayerData.h:98
String name
layer name
Definition: LayerData.h:281
bool flipped
if this layer is flipped (1d mirror view)
Definition: LayerData.h:275
ExperimentSharedPtrType & getChromatogramData()
Returns a mutable reference to the current chromatogram data.
Definition: LayerData.h:198
ExperimentSharedPtrType chromatograms
chromatogram data
Definition: LayerData.h:321
Param param
Layer parameters.
Definition: LayerData.h:290
const ExperimentSharedPtrType & getPeakData() const
Returns a const reference to the current peak data.
Definition: LayerData.h:180
Feature data.
Definition: LayerData.h:70
Annotations1DContainer & getAnnotations(Size spectrum_index)
Returns a mutable reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:222
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:117
Consensus feature data.
Definition: LayerData.h:71
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
ConsensusMapSharedPtrType & getConsensusMap()
Returns current consensus map (mutable)
Definition: LayerData.h:174
String filename
file name of the file the data comes from (if available)
Definition: LayerData.h:284
const ExperimentSharedPtrType & getChromatogramData() const
Returns a const reference to the current chromatogram data.
Definition: LayerData.h:192
Size current_spectrum_
Index of the current spectrum.
Definition: LayerData.h:324
void set_chromatogram_flag()
Definition: LayerData.h:257
ExperimentSharedPtrType peaks
peak data
Definition: LayerData.h:318
ConsensusMap ConsensusMapType
consensus features
Definition: LayerData.h:114
const Annotations1DContainer & getAnnotations(Size spectrum_index) const
Returns a const reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:216
bool chromatogram_flag_set() const
Check whether the current layer is a chromatogram.
Definition: LayerData.h:249
Management and storage of parameters / INI files.
Definition: Param.h:75
Peaks: Show projections.
Definition: LayerData.h:84
bool modifiable
Flag that indicates if the layer data can be modified (so far used for features only) ...
Definition: LayerData.h:302
Peaks: Mark precursor peaks of MS/MS scans.
Definition: LayerData.h:83
void setCurrentSpectrumIndex(Size index)
Set the index of the current spectrum.
Definition: LayerData.h:240
std::vector< PeptideIdentification > peptides
peptide identifications
Definition: LayerData.h:287
DataFilters filters
Filters to apply before painting.
Definition: LayerData.h:296
LayerData()
Default constructor.
Definition: LayerData.h:128
DataType type
data type (peak or feature data)
Definition: LayerData.h:278
LabelType
Label used in visualization.
Definition: LayerData.h:94
The best peptide hit of the first identification run is used.
Definition: LayerData.h:99
Spectrum profile or centroided data.
Definition: LayerData.h:69
const ExperimentType::SpectrumType & getCurrentSpectrum() const
Returns a const reference to the current spectrum (1d view)
DataFilter array providing some convenience functions.
Definition: DataFilters.h:51
A gradient of multiple colors and arbitrary distances between colors.
Definition: MultiGradient.h:68
The element number is used.
Definition: LayerData.h:97
MultiGradient gradient
Gradient for 2D and 3D views.
Definition: LayerData.h:293
Container for annotations to content of Spectrum1DCanvas.
Definition: Annotations1DContainer.h:54
No label is displayed.
Definition: LayerData.h:96
ConsensusMapSharedPtrType consensus
consensus feature data
Definition: LayerData.h:315
Features: Unassigned peptide hits.
Definition: LayerData.h:82
bool visible
if this layer is visible
Definition: LayerData.h:272
Definition: LayerData.h:101
Class that stores the data for one layer.
Definition: LayerData.h:61
Identifications: m/z source.
Definition: LayerData.h:86
FeatureMap FeatureMapType
Features.
Definition: LayerData.h:108

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:39 using doxygen 1.8.5