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-2017.
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
39 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
40 
49 
50 #include <boost/shared_ptr.hpp>
51 
52 #include <vector>
53 #include <bitset>
54 
55 namespace OpenMS
56 {
62  class LayerData
63  {
64 public:
67  enum DataType
69  {
76  };
77 
79  enum Flags
80  {
89  };
90 
92  std::bitset<SIZE_OF_FLAGS> flags;
93 
95  enum LabelType
96  {
103  };
104 
106  static const std::string NamesOfLabelType[SIZE_OF_LABEL_TYPE];
107 
110 
112  typedef boost::shared_ptr<FeatureMap > FeatureMapSharedPtrType;
113 
116 
118  typedef boost::shared_ptr<ConsensusMap> ConsensusMapSharedPtrType;
119 
122 
124  typedef boost::shared_ptr<ExperimentType> ExperimentSharedPtrType;
125 
127 
130  flags(),
131  visible(true),
132  flipped(false),
133  type(DT_UNKNOWN),
134  name(),
135  filename(),
136  peptides(),
137  param(),
138  gradient(),
139  filters(),
140  annotations_1d(),
141  modifiable(false),
142  modified(false),
143  label(L_NONE),
144  peptide_id_index(-1),
145  peptide_hit_index(-1),
146  features(new FeatureMapType()),
147  consensus(new ConsensusMapType()),
148  peaks(new ExperimentType()),
149  chromatograms(new ExperimentType()),
151  {
152  annotations_1d.resize(1);
153  }
154 
157 
159  const FeatureMapSharedPtrType & getFeatureMap() const
160  {
161  return features;
162  }
163 
165  FeatureMapSharedPtrType & getFeatureMap()
166  {
167  return features;
168  }
169 
171  const ConsensusMapSharedPtrType & getConsensusMap() const
172  {
173  return consensus;
174  }
175 
177  ConsensusMapSharedPtrType & getConsensusMap()
178  {
179  return consensus;
180  }
181 
183  const ExperimentSharedPtrType & getPeakData() const
184  {
185  return peaks;
186  }
187 
189  ExperimentSharedPtrType & getPeakData()
190  {
191  return peaks;
192  }
193 
195  const ExperimentSharedPtrType & getChromatogramData() const
196  {
197  return chromatograms;
198  }
199 
201  ExperimentSharedPtrType & getChromatogramData()
202  {
203  return chromatograms;
204  }
205 
208  {
210  }
211 
214  {
216  }
217 
219  const Annotations1DContainer & getAnnotations(Size spectrum_index) const
220  {
221  return annotations_1d[spectrum_index];
222  }
223 
226  {
227  return annotations_1d[spectrum_index];
228  }
229 
232  {
233  return (*peaks)[current_spectrum_];
234  }
235 
238  {
239  return current_spectrum_;
240  }
241 
244  {
245  current_spectrum_ = index;
246  }
247 
249  // we need this specifically because this->type will *not* distinguish
250  // chromatogram and spectra data since we need to store chromatograms for
251  // the 1D case in a layer that looks like PEAK data to all tools.
253  {
254  return this->getPeakData()->size() > 0 &&
255  this->getPeakData()->metaValueExists("is_chromatogram") &&
256  this->getPeakData()->getMetaValue("is_chromatogram").toBool();
257  }
258 
259  // set the chromatogram flag
261  {
262  this->getPeakData()->setMetaValue("is_chromatogram", "true");
263  }
264 
265  // remove the chromatogram flag
267  {
268  if (this->chromatogram_flag_set())
269  {
270  this->getPeakData()->removeMetaValue("is_chromatogram");
271  }
272  }
273 
277 
279  void removePeakAnnotationsFromPeptideHit(const std::vector<Annotation1DItem*>& selected_annotations);
280 
282  bool visible;
283 
285  bool flipped;
286 
289 
292 
295 
297  std::vector<PeptideIdentification> peptides;
298 
301 
304 
307 
309  std::vector<Annotations1DContainer> annotations_1d;
310 
313 
315  bool modified;
316 
319 
323 
324 private:
327 
329  FeatureMapSharedPtrType features;
330 
332  ConsensusMapSharedPtrType consensus;
333 
335  ExperimentSharedPtrType peaks;
336 
338  ExperimentSharedPtrType chromatograms;
339 
342  };
343 
345  OPENMS_GUI_DLLAPI std::ostream & operator<<(std::ostream & os, const LayerData & rhs);
346 
347 } //namespace
348 
349 #endif
Flags
Flags that determine which information is shown.
Definition: LayerData.h:79
const Annotations1DContainer & getAnnotations(Size spectrum_index) const
Returns a const reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:219
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:112
void removePeakAnnotationsFromPeptideHit(const std::vector< Annotation1DItem *> &selected_annotations)
remove peak annotations in the given list from the currently active PeptideHit
Consensus features: Show elements.
Definition: LayerData.h:86
static const std::string NamesOfLabelType[SIZE_OF_LABEL_TYPE]
Label names.
Definition: LayerData.h:106
Features: Convex hulls of single mass traces.
Definition: LayerData.h:82
FeatureMapSharedPtrType features
feature data
Definition: LayerData.h:329
std::bitset< SIZE_OF_FLAGS > flags
Actual state of each flag.
Definition: LayerData.h:92
Features: Overall convex hull.
Definition: LayerData.h:81
Definition: LayerData.h:88
A more convenient string class.
Definition: String.h:57
LabelType label
Label type.
Definition: LayerData.h:318
PeakMap ExperimentType
Main data type (experiment)
Definition: LayerData.h:121
const ExperimentType::SpectrumType & getCurrentSpectrum() const
Returns a const reference to the current spectrum (1d view)
void synchronizePeakAnnotations()
DataType
Dataset types.
Definition: LayerData.h:68
bool modified
Flag that indicates that the layer data was modified since loading it.
Definition: LayerData.h:315
A container for features.
Definition: FeatureMap.h:94
FeatureMapSharedPtrType & getFeatureMap()
Returns a const reference to the current feature data.
Definition: LayerData.h:165
void remove_chromatogram_flag()
Definition: LayerData.h:266
ExperimentType::SpectrumType & getCurrentSpectrum()
Returns a mutable reference to the current spectrum (1d view)
Definition: LayerData.h:231
All peptide hits of the first identification run are used.
Definition: LayerData.h:101
A container for consensus elements.
Definition: ConsensusMap.h:72
Undefined data type indicating an error.
Definition: LayerData.h:75
Peptide identification data.
Definition: LayerData.h:74
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Annotations1DContainer & getCurrentAnnotations()
Returns a mutable reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:213
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:124
bool chromatogram_flag_set() const
Check whether the current layer is a chromatogram.
Definition: LayerData.h:252
Chromatogram data.
Definition: LayerData.h:73
std::vector< Annotations1DContainer > annotations_1d
Annotations of all spectra of the experiment (1D view)
Definition: LayerData.h:309
const ExperimentSharedPtrType & getChromatogramData() const
Returns a const reference to the current chromatogram data.
Definition: LayerData.h:195
const ExperimentSharedPtrType & getPeakData() const
Returns a const reference to the current peak data.
Definition: LayerData.h:183
ExperimentSharedPtrType & getPeakData()
Returns a mutable reference to the current peak data.
Definition: LayerData.h:189
The &#39;label&#39; meta information is used.
Definition: LayerData.h:99
String name
layer name
Definition: LayerData.h:291
bool flipped
if this layer is flipped (1d mirror view)
Definition: LayerData.h:285
ExperimentSharedPtrType & getChromatogramData()
Returns a mutable reference to the current chromatogram data.
Definition: LayerData.h:201
const Annotations1DContainer & getCurrentAnnotations() const
Returns a const reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:207
ExperimentSharedPtrType chromatograms
chromatogram data
Definition: LayerData.h:338
Param param
Layer parameters.
Definition: LayerData.h:300
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
const FeatureMapSharedPtrType & getFeatureMap() const
Returns a const reference to the current feature data.
Definition: LayerData.h:159
Feature data.
Definition: LayerData.h:71
Annotations1DContainer & getAnnotations(Size spectrum_index)
Returns a mutable reference to the annotations of the current spectrum (1d view)
Definition: LayerData.h:225
Representation of a peptide hit.
Definition: PeptideHit.h:55
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:118
Consensus feature data.
Definition: LayerData.h:72
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
ConsensusMapSharedPtrType & getConsensusMap()
Returns current consensus map (mutable)
Definition: LayerData.h:177
String filename
file name of the file the data comes from (if available)
Definition: LayerData.h:294
Size current_spectrum_
Index of the current spectrum.
Definition: LayerData.h:341
void set_chromatogram_flag()
Definition: LayerData.h:260
ExperimentSharedPtrType peaks
peak data
Definition: LayerData.h:335
ConsensusMap ConsensusMapType
consensus features
Definition: LayerData.h:115
Management and storage of parameters / INI files.
Definition: Param.h:75
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
Peaks: Show projections.
Definition: LayerData.h:85
bool modifiable
Flag that indicates if the layer data can be modified (so far used for features only) ...
Definition: LayerData.h:312
int peptide_hit_index
Definition: LayerData.h:322
Peaks: Mark precursor peaks of MS/MS scans.
Definition: LayerData.h:84
void setCurrentSpectrumIndex(Size index)
Set the index of the current spectrum.
Definition: LayerData.h:243
int peptide_id_index
Selected peptide id and hit index (-1 if none is selected)
Definition: LayerData.h:321
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
std::vector< PeptideIdentification > peptides
peptide identifications
Definition: LayerData.h:297
const ConsensusMapSharedPtrType & getConsensusMap() const
Returns a const reference to the consensus feature data.
Definition: LayerData.h:171
DataFilters filters
Filters to apply before painting.
Definition: LayerData.h:306
LayerData()
Default constructor.
Definition: LayerData.h:129
DataType type
data type (peak or feature data)
Definition: LayerData.h:288
LabelType
Label used in visualization.
Definition: LayerData.h:95
The best peptide hit of the first identification run is used.
Definition: LayerData.h:100
Spectrum profile or centroided data.
Definition: LayerData.h:70
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:98
MultiGradient gradient
Gradient for 2D and 3D views.
Definition: LayerData.h:303
Size getCurrentSpectrumIndex() const
Get the index of the current spectrum.
Definition: LayerData.h:237
Container for annotations to content of Spectrum1DCanvas.
Definition: Annotations1DContainer.h:54
No label is displayed.
Definition: LayerData.h:97
ConsensusMapSharedPtrType consensus
consensus feature data
Definition: LayerData.h:332
Features: Unassigned peptide hits.
Definition: LayerData.h:83
bool visible
if this layer is visible
Definition: LayerData.h:282
Definition: LayerData.h:102
Class that stores the data for one layer.
Definition: LayerData.h:62
void updatePeptideHitAnnotations_(PeptideHit &hit)
updates the PeakAnnotations in the current PeptideHit with manually changed annotations ...
Identifications: m/z source.
Definition: LayerData.h:87
FeatureMap FeatureMapType
Features.
Definition: LayerData.h:109

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:01 using doxygen 1.8.13