OpenMS
Loading...
Searching...
No Matches
LayerDataPeak.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Chris Bielow $
6// $Authors: Chris Bielow $
7// --------------------------------------------------------------------------
8
9#pragma once
10
13
16
17#include <vector>
18
19namespace OpenMS
20{
21 class Annotation1DItem;
22
28 class OPENMS_GUI_DLLAPI LayerDataPeak : public virtual LayerDataBase
29 {
30 public:
31
34
38 LayerDataPeak(const LayerDataPeak& ld) = default;
41
42 std::unique_ptr<Painter2DBase> getPainter2D() const override;
43
44 std::unique_ptr<LayerData1DBase> to1DLayer() const override;
45
46 std::unique_ptr<LayerStoreData> storeVisibleData(const RangeAllType& visible_range, const DataFilters& layer_filters) const override;
47
48 std::unique_ptr<LayerStoreData> storeFullData() const override;
49
50 ProjectionData getProjection(const DIM_UNIT unit_x, const DIM_UNIT unit_y, const RangeAllType& area) const override;
51
52 PeakIndex findHighestDataPoint(const RangeAllType& area) const override;
53
54 void updateRanges() override
55 {
56 peak_map_->getMSExperiment().updateRanges();
57 // on_disc_peaks_->updateRanges(); // note: this is not going to work since its on disk! We currently don't have a good way to access these ranges
58 }
59
60 RangeAllType getRange() const override
61 {
63 r.assign(peak_map_->getMSExperiment().spectrumRanges());
64 return r;
65 }
66
67 PointXYType peakIndexToXY(const PeakIndex& peak, const DimMapper<2>& mapper) const override;
68
69 String getDataArrayDescription(const PeakIndex& peak_index) override;
70
71 std::unique_ptr<LayerStatistics> getStats() const override;
72
73 bool annotate(const PeptideIdentificationList& identifications, const std::vector<ProteinIdentification>& protein_identifications) override;
74
76 {
77 if (peak_map_->getMSExperiment()[spectrum_idx].size() > 0)
78 {
79 return peak_map_->getMSExperiment()[spectrum_idx];
80 }
81 if (!on_disc_peaks_->empty())
82 {
83 static MSSpectrum local_spec;
84 local_spec = on_disc_peaks_->getSpectrum(spectrum_idx);
85 return local_spec;
86 }
87 return peak_map_->getMSExperiment()[spectrum_idx];
88 }
89
100
111 {
112 return peak_map_;
113 }
114
119 {
120 peak_map_ = p;
121 }
122
125 {
126 on_disc_peaks_ = p;
127 }
128
131 {
132 return on_disc_peaks_;
133 }
134
135
136
138 bool isIonMobilityData() const
139 {
140 const MSExperiment& exp = this->getPeakData()->getMSExperiment();
141 return exp.size() > 0
142 && exp.metaValueExists("is_ion_mobility")
143 && exp.getMetaValue("is_ion_mobility").toBool();
144 }
145
147 {
148 peak_map_->getMSExperiment().setMetaValue("is_ion_mobility", "true");
149 }
150
152 bool isDIAData() const
153 {
154 const MSExperiment& exp = this->getPeakData()->getMSExperiment();
155 return exp.size() > 0
156 && exp.metaValueExists("is_dia_data")
157 && exp.getMetaValue("is_dia_data").toBool();
158 }
159
162 {
163 peak_map_->getMSExperiment().setMetaValue("is_dia_data", "true");
164 }
165
175 {
176 const MSExperiment& exp = this->getPeakData()->getMSExperiment();
177 return exp.size() > 0
178 && exp.metaValueExists("is_chromatogram")
179 && exp.getMetaValue("is_chromatogram").toBool();
180 }
181
184 {
185 peak_map_->getMSExperiment().setMetaValue("is_chromatogram", "true");
186 }
187
190 {
191 if (this->chromatogram_flag_set())
192 {
193 peak_map_->getMSExperiment().removeMetaValue("is_chromatogram");
194 }
195 }
196
197
198 protected:
201
204 };
205
206}// namespace OpenMS
Class for storing MS run data with peptide and protein identifications.
Definition AnnotatedMSRun.h:38
DataFilter array providing some convenience functions.
Definition DataFilters.h:27
bool toBool() const
Conversion to bool.
Allows dynamical switching (at runtime) between a dimension (RT, m/z, int, IM, etc) and X,...
Definition DimMapper.h:662
Class that stores the data for one layer.
Definition LayerDataBase.h:170
Class that stores the data for one layer of type PeakMap.
Definition LayerDataPeak.h:29
void remove_chromatogram_flag()
remove the chromatogram flag
Definition LayerDataPeak.h:189
LayerDataPeak()
Default constructor.
LayerDataPeak & operator=(const LayerDataPeak &ld)=delete
no assignment operator (should not be needed)
std::unique_ptr< LayerStoreData > storeFullData() const override
Returns a visitor which contains the the full data of the layer and can write the data to disk in the...
bool isDIAData() const
Check whether the current layer contains DIA (SWATH-MS) data.
Definition LayerDataPeak.h:152
void set_chromatogram_flag()
set the chromatogram flag
Definition LayerDataPeak.h:183
void setOnDiscPeakData(ODExperimentSharedPtrType p)
Set the current on-disc data.
Definition LayerDataPeak.h:124
const ConstExperimentSharedPtrType getPeakData() const
Returns a const reference to the current in-memory peak data.
bool isIonMobilityData() const
Check whether the current layer should be represented as ion mobility.
Definition LayerDataPeak.h:138
PeakIndex findHighestDataPoint(const RangeAllType &area) const override
Find the datapoint with the highest intensity within the given range and return a proxy to that datap...
const ExperimentType::SpectrumType & getSpectrum(Size spectrum_idx) const
Definition LayerDataPeak.h:75
bool chromatogram_flag_set() const
Check whether the current layer is a chromatogram.
Definition LayerDataPeak.h:174
void setPeakData(ExperimentSharedPtrType p)
Set the current in-memory peak data.
Definition LayerDataPeak.h:118
void labelAsIonMobilityData() const
Definition LayerDataPeak.h:146
PointXYType peakIndexToXY(const PeakIndex &peak, const DimMapper< 2 > &mapper) const override
Convert a PeakIndex to a XY coordinate (via mapper).
std::unique_ptr< LayerStatistics > getStats() const override
Compute layer statistics (via visitor)
ProjectionData getProjection(const DIM_UNIT unit_x, const DIM_UNIT unit_y, const RangeAllType &area) const override
RangeAllType getRange() const override
Definition LayerDataPeak.h:60
std::unique_ptr< LayerStoreData > storeVisibleData(const RangeAllType &visible_range, const DataFilters &layer_filters) const override
Returns a visitor which contains the current visible data and can write the data to disk.
LayerDataPeak(const LayerDataPeak &ld)=default
Copy-ctor.
const ODExperimentSharedPtrType & getOnDiscPeakData() const
Returns a mutable reference to the on-disc data.
Definition LayerDataPeak.h:130
std::unique_ptr< LayerData1DBase > to1DLayer() const override
Create a shallow copy (i.e. shared experimental data using shared_ptr) of the current layer,...
const ExperimentSharedPtrType & getPeakDataMuteable()
Returns a mutable reference to the current in-memory peak data.
Definition LayerDataPeak.h:110
bool annotate(const PeptideIdentificationList &identifications, const std::vector< ProteinIdentification > &protein_identifications) override
void updateRanges() override
Update ranges of the underlying data.
Definition LayerDataPeak.h:54
std::unique_ptr< Painter2DBase > getPainter2D() const override
Obtain a painter which can draw the layer on a 2D canvas.
String getDataArrayDescription(const PeakIndex &peak_index) override
Get name and value of all data-arrays corresponding to the given datapoint.
void labelAsDIAData()
Label the current layer as DIA (SWATH-MS) data.
Definition LayerDataPeak.h:161
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
Size size() const noexcept
The number of spectra.
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
bool metaValueExists(const String &name) const
Returns whether an entry with the given name exists.
const DataValue & getMetaValue(const String &name) const
Returns the value corresponding to a string, or DataValue::EMPTY if not found.
Representation of a mass spectrometry experiment on disk.
Definition OnDiscMSExperiment.h:71
A 1-dimensional raw data point or peak.
Definition Peak1D.h:30
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
auto & assign(const RangeManager< RangeBasesOther... > &rhs)
Definition RangeManager.h:615
A more convenient string class.
Definition String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
DIM_UNIT
Definition CommonEnums.h:20
Result of computing a projection on X and Y axis in a 2D Canvas; see LayerDataBase::getProjection()
Definition LayerDataBase.h:52
std::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition LayerDataBase.h:127
std::shared_ptr< const ExperimentType > ConstExperimentSharedPtrType
Definition LayerDataBase.h:129
std::shared_ptr< OnDiscMSExperiment > ODExperimentSharedPtrType
SharedPtr on On-Disc MSExperiment.
Definition LayerDataBase.h:132
Index of a peak or feature.
Definition PeakIndex.h:25