OpenMS
openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Hannes Roest $
6 // $Authors: Darren Kessner, Hannes Roest, Witold Wolski$
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <string>
12 #include <vector>
13 #include <boost/shared_ptr.hpp>
14 
15 #include <OpenMS/OPENSWATHALGO/OpenSwathAlgoConfig.h>
16 
17 namespace OpenSwath
18 {
41  struct OPENSWATHALGO_DLLAPI OSBinaryDataArray
42  {
44  //DataProcessingPtr dataProcessingPtr;
45 
47  std::vector<double> data;
48 
50  std::string description;
51  };
53  typedef boost::shared_ptr<BinaryDataArray> BinaryDataArrayPtr;
54 
56  struct OPENSWATHALGO_DLLAPI OSChromatogramMeta
57  {
59  std::size_t index;
61  std::string id;
63  index()
64  {
65  }
66 
67  };
69  typedef boost::shared_ptr<ChromatogramMeta> ChromatogramMetaPtr;
70 
72  struct OPENSWATHALGO_DLLAPI OSChromatogram
73  {
74 private:
76  std::size_t defaultArrayLength;
77 
79  //DataProcessingPtr dataProcessingPtr;
81  //Precursor precursor;
83  //Product product;
84 
86  std::vector<BinaryDataArrayPtr> binaryDataArrayPtrs;
87 public:
88 
90  defaultArrayLength(2),
91  binaryDataArrayPtrs(defaultArrayLength)
92  {
93  initvec();
94  }
95 
96 private:
97 
98  void initvec()
99  {
100  for (std::size_t i = 0; i < defaultArrayLength; ++i)
101  {
103  binaryDataArrayPtrs[i] = empty;
104  }
105  }
106 
107 public:
110  {
111  return binaryDataArrayPtrs[0];
112  }
113 
116  {
117  binaryDataArrayPtrs[0] = data;
118  }
119 
122  {
123  return binaryDataArrayPtrs[1];
124  }
125 
128  {
129  binaryDataArrayPtrs[1] = data;
130  }
131 
133  const std::vector<BinaryDataArrayPtr> & getDataArrays() const
134  {
135  return binaryDataArrayPtrs;
136  }
137 
139  std::vector<BinaryDataArrayPtr> & getDataArrays()
140  {
141  return binaryDataArrayPtrs;
142  }
143 
144  };
146  typedef boost::shared_ptr<Chromatogram> ChromatogramPtr;
147 
149  struct OPENSWATHALGO_DLLAPI OSSpectrumMeta
150  {
152  size_t index;
153 
155  std::string id;
156 
157  double RT;
158 
159  int ms_level;
160 
162  index(0)
163  {
164  }
165 
167  struct RTLess
168  {
169  inline bool operator()(const OSSpectrumMeta& a, const OSSpectrumMeta& b) const
170  {
171  return a.RT < b.RT;
172  }
173  };
174 
175  };
177  typedef boost::shared_ptr<SpectrumMeta> SpectrumMetaPtr;
178 
180  struct OPENSWATHALGO_DLLAPI OSSpectrum
181  {
182 private:
184  std::size_t defaultArrayLength;
185 
187  std::vector<BinaryDataArrayPtr> binaryDataArrayPtrs;
188 
189 public:
191  defaultArrayLength(2),
192  binaryDataArrayPtrs(defaultArrayLength)
193  {
194  initvec();
195  }
196 
197 private:
198 
199  void initvec()
200  {
201  for (std::size_t i = 0; i < defaultArrayLength; ++i)
202  {
204  binaryDataArrayPtrs[i] = empty;
205  }
206  }
207 
208 public:
209 
212  {
213  return binaryDataArrayPtrs[0];
214  }
215 
218  {
219  binaryDataArrayPtrs[0] = data;
220  }
221 
224  {
225  return binaryDataArrayPtrs[1];
226  }
227 
230  {
231  binaryDataArrayPtrs[1] = data;
232  }
233 
235  {
236  data->description = "Ion Mobility";
237  binaryDataArrayPtrs.push_back(data);
238  }
239 
242  {
243  // The array name starts with "Ion Mobility", but may carry additional
244  // information such as the actual unit in which it was measured (seconds,
245  // milliseconds, volt-second per square centimeter). We currently ignore
246  // the unit but return the correct array.
247  // For diaPASEF data converted with proteowizard ion mobility arrays are stored in "inverse reduced ion mobility"
248  for (auto & bda : binaryDataArrayPtrs)
249  {
250  if (bda->description.find("Ion Mobility") == 0)
251  {
252  return bda;
253  }
254  else if (bda->description.find("mean inverse reduced ion mobility array") == 0)
255  {
256  return bda;
257  }
258  }
259  return BinaryDataArrayPtr(); // return null
260  }
261 
263  const std::vector<BinaryDataArrayPtr> & getDataArrays() const
264  {
265  return binaryDataArrayPtrs;
266  }
267 
269  std::vector<BinaryDataArrayPtr> & getDataArrays()
270  {
271  return binaryDataArrayPtrs;
272  }
273 
274  };
276  typedef boost::shared_ptr<Spectrum> SpectrumPtr;
277 } //end Namespace OpenSwath
278 
Definition: Scoring.h:18
OSBinaryDataArray BinaryDataArray
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:52
std::vector< double > data
this optional attribute may reference the 'id' attribute of the appropriate dataProcessing.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:47
boost::shared_ptr< ChromatogramMeta > ChromatogramMetaPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:69
std::string description
(optional) data description for non-standard arrays.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:50
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:146
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:53
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:276
OSSpectrum Spectrum
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:275
boost::shared_ptr< SpectrumMeta > SpectrumMetaPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:177
OSChromatogramMeta ChromatogramMeta
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:68
OSChromatogram Chromatogram
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:145
OSSpectrumMeta SpectrumMeta
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:176
The datastructures used by the OpenSwath interfaces.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:42
Identifying information for a chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:57
OSChromatogramMeta()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:62
std::size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:59
std::string id
a unique identifier for this chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:61
A single chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:73
void setIntensityArray(BinaryDataArrayPtr data)
set intensity array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:127
std::size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:76
void setTimeArray(BinaryDataArrayPtr data)
set time array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:115
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:86
BinaryDataArrayPtr getIntensityArray()
get intensity array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:121
std::vector< BinaryDataArrayPtr > & getDataArrays()
mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:139
void initvec()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:98
const std::vector< BinaryDataArrayPtr > & getDataArrays() const
non-mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:133
OSChromatogram()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:89
BinaryDataArrayPtr getTimeArray()
get time array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:109
Comparator for the retention time.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:168
bool operator()(const OSSpectrumMeta &a, const OSSpectrumMeta &b) const
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:169
Identifying information for a spectrum.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:150
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:152
OSSpectrumMeta()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:161
int ms_level
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:159
double RT
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:157
std::string id
a unique identifier for this spectrum.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:155
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:181
void setIntensityArray(BinaryDataArrayPtr data)
set intensity array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:229
std::size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:184
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:187
BinaryDataArrayPtr getDriftTimeArray() const
get drift time array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:241
BinaryDataArrayPtr getMZArray() const
get m/z array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:211
OSSpectrum()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:190
std::vector< BinaryDataArrayPtr > & getDataArrays()
mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:269
BinaryDataArrayPtr getIntensityArray() const
get intensity array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:223
void initvec()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:199
void setMZArray(BinaryDataArrayPtr data)
set m/z array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:217
void setDriftTimeArray(BinaryDataArrayPtr data)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:234
const std::vector< BinaryDataArrayPtr > & getDataArrays() const
non-mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:263