| OpenMS 2.5.0

openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.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-2020.
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: Darren Kessner, Hannes Roest, Witold Wolski$
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 #include <string>
38 #include <vector>
39 #include <boost/shared_ptr.hpp>
40
41 #include <OpenMS/OPENSWATHALGO/OpenSwathAlgoConfig.h>
42
43 namespace OpenSwath
44 {
66 struct OPENSWATHALGO_DLLAPI OSBinaryDataArray
68 {
70 //DataProcessingPtr dataProcessingPtr;
71
73 std::vector<double> data;
74
76 std::string description;
77 };
78 typedef OSBinaryDataArray BinaryDataArray;
79 typedef boost::shared_ptr<BinaryDataArray> BinaryDataArrayPtr;
80
82 struct OPENSWATHALGO_DLLAPI OSChromatogramMeta
83 {
85 std::size_t index;
87 std::string id;
88 OSChromatogramMeta() :
89 index()
90 {
91 }
92
93 };
94 typedef OSChromatogramMeta ChromatogramMeta;
95 typedef boost::shared_ptr<ChromatogramMeta> ChromatogramMetaPtr;
96
98 struct OPENSWATHALGO_DLLAPI OSChromatogram
99 {
100 private:
102 std::size_t defaultArrayLength;
103
105 //DataProcessingPtr dataProcessingPtr;
107 //Precursor precursor;
109 //Product product;
110
112 std::vector<BinaryDataArrayPtr> binaryDataArrayPtrs;
113 public:
114
115 OSChromatogram() :
116 defaultArrayLength(2),
117 binaryDataArrayPtrs(defaultArrayLength)
118 {
119 initvec();
120 }
121
122 private:
123
124 void initvec()
125 {
126 for (std::size_t i = 0; i < defaultArrayLength; ++i)
127 {
128 BinaryDataArrayPtr empty(new BinaryDataArray);
129 binaryDataArrayPtrs[i] = empty;
130 }
131 }
132
133 public:
135 BinaryDataArrayPtr getTimeArray()
136 {
137 return binaryDataArrayPtrs[0];
138 }
139
141 void setTimeArray(BinaryDataArrayPtr data)
142 {
143 binaryDataArrayPtrs[0] = data;
144 }
145
147 BinaryDataArrayPtr getIntensityArray()
148 {
149 return binaryDataArrayPtrs[1];
150 }
151
153 void setIntensityArray(BinaryDataArrayPtr data)
154 {
155 binaryDataArrayPtrs[1] = data;
156 }
157
159 const std::vector<BinaryDataArrayPtr> & getDataArrays() const
160 {
161 return binaryDataArrayPtrs;
162 }
163
165 std::vector<BinaryDataArrayPtr> & getDataArrays()
166 {
167 return binaryDataArrayPtrs;
168 }
169
170 };
171 typedef OSChromatogram Chromatogram;
172 typedef boost::shared_ptr<Chromatogram> ChromatogramPtr;
173
175 struct OPENSWATHALGO_DLLAPI OSSpectrumMeta
176 {
178 size_t index;
179
181 std::string id;
182
183 double RT;
184
185 int ms_level;
186
187 OSSpectrumMeta() :
188 index(0)
189 {
190 }
191
193 struct RTLess :
194 public std::binary_function<OSSpectrumMeta, OSSpectrumMeta, bool>
195 {
196 inline bool operator()(const OSSpectrumMeta& a, const OSSpectrumMeta& b) const
197 {
198 return a.RT < b.RT;
199 }
200 };
201
202 };
203 typedef OSSpectrumMeta SpectrumMeta;
204 typedef boost::shared_ptr<SpectrumMeta> SpectrumMetaPtr;
205
207 struct OPENSWATHALGO_DLLAPI OSSpectrum
208 {
209 private:
211 std::size_t defaultArrayLength;
212
214 std::vector<BinaryDataArrayPtr> binaryDataArrayPtrs;
215
216 public:
217 OSSpectrum() :
218 defaultArrayLength(2),
219 binaryDataArrayPtrs(defaultArrayLength)
220 {
221 initvec();
222 }
223
224 private:
225
226 void initvec()
227 {
228 for (std::size_t i = 0; i < defaultArrayLength; ++i)
229 {
230 BinaryDataArrayPtr empty(new BinaryDataArray);
231 binaryDataArrayPtrs[i] = empty;
232 }
233 }
234
235 public:
236
238 BinaryDataArrayPtr getMZArray() const
239 {
240 return binaryDataArrayPtrs[0];
241 }
242
244 void setMZArray(BinaryDataArrayPtr data)
245 {
246 binaryDataArrayPtrs[0] = data;
247 }
248
250 BinaryDataArrayPtr getIntensityArray() const
251 {
252 return binaryDataArrayPtrs[1];
253 }
254
256 void setIntensityArray(BinaryDataArrayPtr data)
257 {
258 binaryDataArrayPtrs[1] = data;
259 }
260
262 BinaryDataArrayPtr getDriftTimeArray() const
263 {
264 // The array name starts with "Ion Mobility", but may carry additional
265 // information such as the actual unit in which it was measured (seconds,
266 // milliseconds, volt-second per square centimeter). We currently ignore
267 // the unit but return the correct array.
268 for (auto & bda : binaryDataArrayPtrs)
269 {
270 if (bda->description.find("Ion Mobility") == 0)
271 {
272 return bda;
273 }
274 }
275 return BinaryDataArrayPtr(); // return null
276 }
277
279 const std::vector<BinaryDataArrayPtr> & getDataArrays() const
280 {
281 return binaryDataArrayPtrs;
282 }
283
285 std::vector<BinaryDataArrayPtr> & getDataArrays()
286 {
287 return binaryDataArrayPtrs;
288 }
289
290 };
291 typedef OSSpectrum Spectrum;
292 typedef boost::shared_ptr<Spectrum> SpectrumPtr;
293 } //end Namespace OpenSwath
294
OpenSwath::ChromatogramMetaPtr
boost::shared_ptr< ChromatogramMeta > ChromatogramMetaPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:95
OpenSwath::OSSpectrumMeta
Identifying information for a spectrum.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:175
OpenSwath
Definition: MRMScoring.h:49
OpenSwath::OSChromatogram::getTimeArray
BinaryDataArrayPtr getTimeArray()
get time array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:135
OpenSwath::OSChromatogram::getDataArrays
const std::vector< BinaryDataArrayPtr > & getDataArrays() const
non-mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:159
OpenSwath::OSSpectrum::getDriftTimeArray
BinaryDataArrayPtr getDriftTimeArray() const
get drift time array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:262
OpenSwath::OSChromatogram::binaryDataArrayPtrs
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
this attribute can optionally reference the &#39;id&#39; of the appropriate dataProcessing.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:112
OpenSwath::OSChromatogram::setIntensityArray
void setIntensityArray(BinaryDataArrayPtr data)
set intensity array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:153
OpenSwath::OSSpectrum::OSSpectrum
OSSpectrum()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:217
OpenSwath::OSSpectrumMeta::RTLess::operator()
bool operator()(const OSSpectrumMeta &a, const OSSpectrumMeta &b) const
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:196
OpenSwath::OSSpectrum::setMZArray
void setMZArray(BinaryDataArrayPtr data)
set m/z array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:244
OpenSwath::ChromatogramMeta
OSChromatogramMeta ChromatogramMeta
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:94
OpenSwath::SpectrumMetaPtr
boost::shared_ptr< SpectrumMeta > SpectrumMetaPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:204
OpenSwath::BinaryDataArrayPtr
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:79
OpenSwath::OSSpectrum::getMZArray
BinaryDataArrayPtr getMZArray() const
get m/z array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:238
OpenSwath::OSSpectrumMeta::index
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:178
OpenSwath::OSSpectrumMeta::OSSpectrumMeta
OSSpectrumMeta()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:187
OpenSwath::OSChromatogram::getDataArrays
std::vector< BinaryDataArrayPtr > & getDataArrays()
mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:165
OpenSwath::OSSpectrum::defaultArrayLength
std::size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:211
OpenSwath::OSSpectrum
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:207
OpenSwath::OSChromatogram
A single chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:98
OpenSwath::OSSpectrum::binaryDataArrayPtrs
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:214
OpenSwath::OSChromatogram::setTimeArray
void setTimeArray(BinaryDataArrayPtr data)
set time array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:141
OpenSwath::OSSpectrumMeta::RTLess
Comparator for the retention time.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:193
OpenSwath::OSSpectrum::initvec
void initvec()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:226
OpenSwath::OSChromatogramMeta
Identifying information for a chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:82
OpenSwath::OSChromatogram::defaultArrayLength
std::size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:102
OpenSwath::OSChromatogram::OSChromatogram
OSChromatogram()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:115
OpenSwath::OSSpectrumMeta::id
std::string id
a unique identifier for this spectrum.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:181
OpenSwath::OSSpectrum::getIntensityArray
BinaryDataArrayPtr getIntensityArray() const
get intensity array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:250
OpenSwath::OSBinaryDataArray::data
std::vector< double > data
this optional attribute may reference the &#39;id&#39; attribute of the appropriate dataProcessing.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:73
OpenSwath::Spectrum
OSSpectrum Spectrum
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:291
OpenSwath::OSBinaryDataArray
The datastructures used by the OpenSwath interfaces.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:67
OpenSwath::OSSpectrum::setIntensityArray
void setIntensityArray(BinaryDataArrayPtr data)
set intensity array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:256
OpenSwath::OSChromatogram::getIntensityArray
BinaryDataArrayPtr getIntensityArray()
get intensity array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:147
OpenSwath::OSBinaryDataArray::description
std::string description
(optional) data description for non-standard arrays.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:76
OpenSwath::OSSpectrumMeta::ms_level
int ms_level
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:185
OpenSwath::Chromatogram
OSChromatogram Chromatogram
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:171
OpenSwath::OSSpectrumMeta::RT
double RT
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:183
OpenSwath::SpectrumPtr
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:292
OpenSwath::OSSpectrum::getDataArrays
std::vector< BinaryDataArrayPtr > & getDataArrays()
mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:285
OpenSwath::OSSpectrum::getDataArrays
const std::vector< BinaryDataArrayPtr > & getDataArrays() const
non-mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:279
OpenSwath::BinaryDataArray
OSBinaryDataArray BinaryDataArray
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:78
OpenSwath::OSChromatogramMeta::index
std::size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:85
OpenSwath::OSChromatogram::initvec
void initvec()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:124
OpenSwath::SpectrumMeta
OSSpectrumMeta SpectrumMeta
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:203
OpenSwath::ChromatogramPtr
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:172
OpenSwath::OSChromatogramMeta::OSChromatogramMeta
OSChromatogramMeta()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:88
OpenSwath::OSChromatogramMeta::id
std::string id
a unique identifier for this chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:87