OpenMS  3.0.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-2022.
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  };
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 
OpenSwath::OSSpectrumMeta::RTLess::operator()
bool operator()(const OSSpectrumMeta &a, const OSSpectrumMeta &b) const
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:195
OpenSwath::OSSpectrum::getMZArray
BinaryDataArrayPtr getMZArray() const
get m/z array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:237
OpenSwath::SpectrumMetaPtr
boost::shared_ptr< SpectrumMeta > SpectrumMetaPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:203
OpenSwath::OSChromatogram::initvec
void initvec()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:124
OpenSwath::OSSpectrum::binaryDataArrayPtrs
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:213
OpenSwath
Definition: Scoring.h:43
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::ChromatogramMetaPtr
boost::shared_ptr< ChromatogramMeta > ChromatogramMetaPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:95
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:210
OpenSwath::OSSpectrum::getDriftTimeArray
BinaryDataArrayPtr getDriftTimeArray() const
get drift time array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:261
OpenSwath::OSChromatogram::setTimeArray
void setTimeArray(BinaryDataArrayPtr data)
set time array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:141
OpenSwath::OSSpectrum::OSSpectrum
OSSpectrum()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:216
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::OSSpectrum::setMZArray
void setMZArray(BinaryDataArrayPtr data)
set m/z array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:243
OpenSwath::OSSpectrum
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:206
OpenSwath::OSSpectrumMeta::OSSpectrumMeta
OSSpectrumMeta()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:187
OpenSwath::OSChromatogram::OSChromatogram
OSChromatogram()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:115
OpenSwath::OSSpectrum::setIntensityArray
void setIntensityArray(BinaryDataArrayPtr data)
set intensity array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:255
OpenSwath::OSChromatogram::binaryDataArrayPtrs
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:112
OpenSwath::OSSpectrum::getDataArrays
std::vector< BinaryDataArrayPtr > & getDataArrays()
mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:289
OpenSwath::SpectrumMeta
OSSpectrumMeta SpectrumMeta
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:202
OpenSwath::OSSpectrumMeta::id
std::string id
a unique identifier for this spectrum.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:181
OpenSwath::OSChromatogram::getDataArrays
std::vector< BinaryDataArrayPtr > & getDataArrays()
mutable access to the underlying data arrays
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:165
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::OSChromatogramMeta::OSChromatogramMeta
OSChromatogramMeta()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:88
OpenSwath::OSChromatogram::setIntensityArray
void setIntensityArray(BinaryDataArrayPtr data)
set intensity array
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:153
OpenSwath::OSBinaryDataArray::data
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
OpenSwath::OSBinaryDataArray::description
std::string description
(optional) data description for non-standard arrays.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:76
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:283
OpenSwath::OSBinaryDataArray
The datastructures used by the OpenSwath interfaces.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:67
OpenSwath::BinaryDataArray
OSBinaryDataArray BinaryDataArray
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:78
OpenSwath::BinaryDataArrayPtr
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:79
OpenSwath::Chromatogram
OSChromatogram Chromatogram
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:171
OpenSwath::OSChromatogram::getIntensityArray
BinaryDataArrayPtr getIntensityArray()
get intensity array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:147
OpenSwath::Spectrum
OSSpectrum Spectrum
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:295
OpenSwath::OSChromatogramMeta
Identifying information for a chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:82
OpenSwath::OSSpectrum::getIntensityArray
BinaryDataArrayPtr getIntensityArray() const
get intensity array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:249
OpenSwath::OSSpectrumMeta
Identifying information for a spectrum.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:175
OpenSwath::OSSpectrum::initvec
void initvec()
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:225
OpenSwath::OSChromatogram
A single chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:98
OpenSwath::OSSpectrumMeta::ms_level
int ms_level
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:185
OpenSwath::OSChromatogramMeta::id
std::string id
a unique identifier for this chromatogram.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:87
OpenSwath::SpectrumPtr
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:296
OpenSwath::OSSpectrumMeta::RTLess
Comparator for the retention time.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:193
OpenSwath::ChromatogramPtr
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:172
OpenSwath::OSSpectrumMeta::RT
double RT
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:183
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::ChromatogramMeta
OSChromatogramMeta ChromatogramMeta
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:94
OpenSwath::OSChromatogram::getTimeArray
BinaryDataArrayPtr getTimeArray()
get time array (may be null)
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:135