OpenMS
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-2023.
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 {
67  struct OPENSWATHALGO_DLLAPI OSBinaryDataArray
68  {
70  //DataProcessingPtr dataProcessingPtr;
71 
73  std::vector<double> data;
74 
76  std::string description;
77  };
79  typedef boost::shared_ptr<BinaryDataArray> BinaryDataArrayPtr;
80 
82  struct OPENSWATHALGO_DLLAPI OSChromatogramMeta
83  {
85  std::size_t index;
87  std::string id;
89  index()
90  {
91  }
92 
93  };
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 
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  {
129  binaryDataArrayPtrs[i] = empty;
130  }
131  }
132 
133 public:
136  {
137  return binaryDataArrayPtrs[0];
138  }
139 
142  {
143  binaryDataArrayPtrs[0] = data;
144  }
145 
148  {
149  return binaryDataArrayPtrs[1];
150  }
151 
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  };
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 
188  index(0)
189  {
190  }
191 
193  struct RTLess
194  {
195  inline bool operator()(const OSSpectrumMeta& a, const OSSpectrumMeta& b) const
196  {
197  return a.RT < b.RT;
198  }
199  };
200 
201  };
203  typedef boost::shared_ptr<SpectrumMeta> SpectrumMetaPtr;
204 
206  struct OPENSWATHALGO_DLLAPI OSSpectrum
207  {
208 private:
210  std::size_t defaultArrayLength;
211 
213  std::vector<BinaryDataArrayPtr> binaryDataArrayPtrs;
214 
215 public:
217  defaultArrayLength(2),
218  binaryDataArrayPtrs(defaultArrayLength)
219  {
220  initvec();
221  }
222 
223 private:
224 
225  void initvec()
226  {
227  for (std::size_t i = 0; i < defaultArrayLength; ++i)
228  {
230  binaryDataArrayPtrs[i] = empty;
231  }
232  }
233 
234 public:
235 
238  {
239  return binaryDataArrayPtrs[0];
240  }
241 
244  {
245  binaryDataArrayPtrs[0] = data;
246  }
247 
250  {
251  return binaryDataArrayPtrs[1];
252  }
253 
256  {
257  binaryDataArrayPtrs[1] = data;
258  }
259 
262  {
263  // The array name starts with "Ion Mobility", but may carry additional
264  // information such as the actual unit in which it was measured (seconds,
265  // milliseconds, volt-second per square centimeter). We currently ignore
266  // the unit but return the correct array.
267  // For diaPASEF data converted with proteowizard ion mobility arrays are stored in "inverse reduced ion mobility"
268  for (auto & bda : binaryDataArrayPtrs)
269  {
270  if (bda->description.find("Ion Mobility") == 0)
271  {
272  return bda;
273  }
274  else if (bda->description.find("mean inverse reduced ion mobility array") == 0)
275  {
276  return bda;
277  }
278  }
279  return BinaryDataArrayPtr(); // return null
280  }
281 
283  const std::vector<BinaryDataArrayPtr> & getDataArrays() const
284  {
285  return binaryDataArrayPtrs;
286  }
287 
289  std::vector<BinaryDataArrayPtr> & getDataArrays()
290  {
291  return binaryDataArrayPtrs;
292  }
293 
294  };
296  typedef boost::shared_ptr<Spectrum> SpectrumPtr;
297 } //end Namespace OpenSwath
298 
Definition: Scoring.h:44
OSBinaryDataArray BinaryDataArray
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:78
std::vector< double > data
this optional attribute may reference the 'id' attribute of the appropriate dataProcessing.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:73
boost::shared_ptr< ChromatogramMeta > ChromatogramMetaPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:95
std::string description
(optional) data description for non-standard arrays.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:76
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:172
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:79
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:296
OSSpectrum Spectrum
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:295
boost::shared_ptr< SpectrumMeta > SpectrumMetaPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:203
OSChromatogramMeta ChromatogramMeta
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:94
OSChromatogram Chromatogram
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:171
OSSpectrumMeta SpectrumMeta
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:202
The datastructures used by the OpenSwath interfaces.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:68
Identifying information for a chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:83
OSChromatogramMeta()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:88
std::size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:85
std::string id
a unique identifier for this chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:87
A single chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:99
void setIntensityArray(BinaryDataArrayPtr data)
set intensity array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:153
std::size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:102
void setTimeArray(BinaryDataArrayPtr data)
set time array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:141
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:112
BinaryDataArrayPtr getIntensityArray()
get intensity array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:147
std::vector< BinaryDataArrayPtr > & getDataArrays()
mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:165
void initvec()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:124
const std::vector< BinaryDataArrayPtr > & getDataArrays() const
non-mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:159
OSChromatogram()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:115
BinaryDataArrayPtr getTimeArray()
get time array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:135
Comparator for the retention time.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:194
bool operator()(const OSSpectrumMeta &a, const OSSpectrumMeta &b) const
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:195
Identifying information for a spectrum.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:176
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:178
OSSpectrumMeta()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:187
int ms_level
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:185
double RT
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:183
std::string id
a unique identifier for this spectrum.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:181
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:207
void setIntensityArray(BinaryDataArrayPtr data)
set intensity array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:255
std::size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:210
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:213
BinaryDataArrayPtr getDriftTimeArray() const
get drift time array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:261
BinaryDataArrayPtr getMZArray() const
get m/z array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:237
OSSpectrum()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:216
std::vector< BinaryDataArrayPtr > & getDataArrays()
mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:289
BinaryDataArrayPtr getIntensityArray() const
get intensity array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:249
void initvec()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:225
void setMZArray(BinaryDataArrayPtr data)
set m/z array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:243
const std::vector< BinaryDataArrayPtr > & getDataArrays() const
non-mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:283