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-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: Timo Sachsenberg $
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_VISUAL_LAYERDATA_H
36 #define OPENMS_VISUAL_LAYERDATA_H
37 
45 
46 #include <boost/shared_ptr.hpp>
47 
48 #include <vector>
49 #include <bitset>
50 
51 namespace OpenMS
52 {
58  class LayerData
59  {
60 public:
63  enum DataType
65  {
72  };
73 
75  enum Flags
76  {
85  };
86 
88  std::bitset<SIZE_OF_FLAGS> flags;
89 
91  enum LabelType
92  {
96  L_ID,
99  };
100 
102  static const std::string NamesOfLabelType[SIZE_OF_LABEL_TYPE];
103 
106 
108  typedef boost::shared_ptr<FeatureMap<> > FeatureMapSharedPtrType;
109 
112 
114  typedef boost::shared_ptr<ConsensusMap> ConsensusMapSharedPtrType;
115 
118 
120  typedef boost::shared_ptr<ExperimentType> ExperimentSharedPtrType;
121 
123 
126  flags(),
127  visible(true),
128  flipped(false),
129  type(DT_UNKNOWN),
130  name(),
131  filename(),
132  peptides(),
133  param(),
134  gradient(),
135  filters(),
136  annotations_1d(),
137  modifiable(false),
138  modified(false),
139  label(L_NONE),
140  features(new FeatureMapType()),
142  peaks(new ExperimentType()),
144  {
145  annotations_1d.resize(1);
146  }
147 
150 
153  {
154  return features;
155  }
156 
159  {
160  return features;
161  }
162 
165  {
166  return consensus;
167  }
168 
171  {
172  return consensus;
173  }
174 
177  {
178  return peaks;
179  }
180 
183  {
184  return peaks;
185  }
186 
189  {
190  return chromatograms;
191  }
192 
195  {
196  return chromatograms;
197  }
198 
201  {
203  }
204 
207  {
209  }
210 
212  const Annotations1DContainer & getAnnotations(Size spectrum_index) const
213  {
214  return annotations_1d[spectrum_index];
215  }
216 
219  {
220  return annotations_1d[spectrum_index];
221  }
222 
225  {
226  return (*peaks)[current_spectrum_];
227  }
228 
231  {
232  return current_spectrum_;
233  }
234 
237  {
238  current_spectrum_ = index;
239  }
240 
242  // we need this specifically because this->type will *not* distinguish
243  // chromatogram and spectra data since we need to store chromatograms for
244  // the 1D case in a layer that looks like PEAK data to all tools.
246  {
247  return this->getPeakData()->size() > 0 &&
248  this->getPeakData()->metaValueExists("is_chromatogram") &&
249  this->getPeakData()->getMetaValue("is_chromatogram").toBool();
250  }
251 
252  // set the chromatogram flag
254  {
255  this->getPeakData()->setMetaValue("is_chromatogram", "true");
256  }
257 
258  // remove the chromatogram flag
260  {
261  if (this->chromatogram_flag_set())
262  {
263  this->getPeakData()->removeMetaValue("is_chromatogram");
264  }
265  }
266 
268  bool visible;
269 
271  bool flipped;
272 
275 
278 
281 
283  std::vector<PeptideIdentification> peptides;
284 
287 
290 
293 
295  std::vector<Annotations1DContainer> annotations_1d;
296 
299 
301  bool modified;
302 
305 
306 private:
309 
312 
315 
318 
321  };
322 
324  OPENMS_GUI_DLLAPI std::ostream & operator<<(std::ostream & os, const LayerData & rhs);
325 
326 } //namespace
327 
328 #endif
Flags
Flags that determine which information is shown.
Definition: LayerData.h:75
Consensus features: Show elements.
Definition: LayerData.h:82
static const std::string NamesOfLabelType[SIZE_OF_LABEL_TYPE]
Label names.
Definition: LayerData.h:102
Features: Convex hulls of single mass traces.
Definition: LayerData.h:78
MSSpectrum< PeakType > SpectrumType
Spectrum Type.
Definition: MSExperiment.h:91
FeatureMapSharedPtrType features
feature data
Definition: LayerData.h:308
const Annotations1DContainer & getCurrentAnnotations() const
Returns a const reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:200
std::bitset< SIZE_OF_FLAGS > flags
Actual state of each flag.
Definition: LayerData.h:88
Features: Overall convex hull.
Definition: LayerData.h:77
Definition: LayerData.h:84
A more convenient string class.
Definition: String.h:56
LabelType label
Label type.
Definition: LayerData.h:304
const ConsensusMapSharedPtrType & getConsensusMap() const
Returns a const reference to the consensus feature data.
Definition: LayerData.h:164
const FeatureMapSharedPtrType & getFeatureMap() const
Returns a const reference to the current feature data.
Definition: LayerData.h:152
DataType
Dataset types.
Definition: LayerData.h:64
bool modified
Flag that indicates that the layer data was modified since loading it.
Definition: LayerData.h:301
FeatureMapSharedPtrType & getFeatureMap()
Returns a const reference to the current feature data.
Definition: LayerData.h:158
void remove_chromatogram_flag()
Definition: LayerData.h:259
ExperimentType::SpectrumType & getCurrentSpectrum()
Returns a mutable reference to the current spectrum (1d view)
Definition: LayerData.h:224
MSExperiment ExperimentType
Main data type (experiment)
Definition: LayerData.h:117
All peptide hits of the first identification run are used.
Definition: LayerData.h:97
Size getCurrentSpectrumIndex() const
Get the index of the current spectrum.
Definition: LayerData.h:230
std::ostream & operator<<(std::ostream &os, const ItraqQuantifier::ItraqQuantifierStats &stats)
A container for consensus elements.
Definition: ConsensusMap.h:60
Undefined data type indicating an error.
Definition: LayerData.h:71
Peptide identification data.
Definition: LayerData.h:70
Annotations1DContainer & getCurrentAnnotations()
Returns a mutable reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:206
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:120
Chromatogram data.
Definition: LayerData.h:69
std::vector< Annotations1DContainer > annotations_1d
Annotations of all spectra of the experiment (1D view)
Definition: LayerData.h:295
ExperimentSharedPtrType & getPeakData()
Returns a mutable reference to the current peak data.
Definition: LayerData.h:182
The &#39;label&#39; meta information is used.
Definition: LayerData.h:95
String name
layer name
Definition: LayerData.h:277
bool flipped
if this layer is flipped (1d mirror view)
Definition: LayerData.h:271
ExperimentSharedPtrType & getChromatogramData()
Returns a mutable reference to the current chromatogram data.
Definition: LayerData.h:194
ExperimentSharedPtrType chromatograms
chromatogram data
Definition: LayerData.h:317
Param param
Layer parameters.
Definition: LayerData.h:286
const ExperimentSharedPtrType & getPeakData() const
Returns a const reference to the current peak data.
Definition: LayerData.h:176
Feature data.
Definition: LayerData.h:67
Annotations1DContainer & getAnnotations(Size spectrum_index)
Returns a mutable reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:218
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:114
Consensus feature data.
Definition: LayerData.h:68
ConsensusMapSharedPtrType & getConsensusMap()
Returns current consensus map (mutable)
Definition: LayerData.h:170
String filename
file name of the file the data comes from (if available)
Definition: LayerData.h:280
const ExperimentSharedPtrType & getChromatogramData() const
Returns a const reference to the current chromatogram data.
Definition: LayerData.h:188
Size current_spectrum_
Index of the current spectrum.
Definition: LayerData.h:320
void set_chromatogram_flag()
Definition: LayerData.h:253
ExperimentSharedPtrType peaks
peak data
Definition: LayerData.h:314
boost::shared_ptr< FeatureMap<> > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:108
ConsensusMap ConsensusMapType
consensus features
Definition: LayerData.h:111
const Annotations1DContainer & getAnnotations(Size spectrum_index) const
Returns a const reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:212
bool chromatogram_flag_set() const
Check whether the current layer is a chromatogram.
Definition: LayerData.h:245
Management and storage of parameters / INI files.
Definition: Param.h:69
Representation of a mass spectrometry experiment.
Definition: MSExperiment.h:68
Peaks: Show projections.
Definition: LayerData.h:81
bool modifiable
Flag that indicates if the layer data can be modified (so far used for features only) ...
Definition: LayerData.h:298
Peaks: Mark precursor peaks of MS/MS scans.
Definition: LayerData.h:80
void setCurrentSpectrumIndex(Size index)
Set the index of the current spectrum.
Definition: LayerData.h:236
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
std::vector< PeptideIdentification > peptides
peptide identifications
Definition: LayerData.h:283
DataFilters filters
Filters to apply before painting.
Definition: LayerData.h:292
LayerData()
Default constructor.
Definition: LayerData.h:125
DataType type
data type (peak or feature data)
Definition: LayerData.h:274
LabelType
Label used in visualization.
Definition: LayerData.h:91
The best peptide hit of the first identification run is used.
Definition: LayerData.h:96
Spectrum profile or centroided data.
Definition: LayerData.h:66
const ExperimentType::SpectrumType & getCurrentSpectrum() const
Returns a const reference to the current spectrum (1d view)
DataFilter array providing some convenience functions.
Definition: DataFilters.h:53
A gradient of multiple colors and arbitrary distances between colors.
Definition: MultiGradient.h:65
The element number is used.
Definition: LayerData.h:94
MultiGradient gradient
Gradient for 2D and 3D views.
Definition: LayerData.h:289
Container for annotations to content of Spectrum1DCanvas.
Definition: Annotations1DContainer.h:54
No label is displayed.
Definition: LayerData.h:93
ConsensusMapSharedPtrType consensus
consensus feature data
Definition: LayerData.h:311
Features: Unassigned peptide hits.
Definition: LayerData.h:79
bool visible
if this layer is visible
Definition: LayerData.h:268
Definition: LayerData.h:98
Class that stores the data for one layer.
Definition: LayerData.h:58
Identifications: m/z source.
Definition: LayerData.h:83
FeatureMap FeatureMapType
Features.
Definition: LayerData.h:105

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