OpenMS
SwathFileConsumer.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, 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: Hannes Roest $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // Datastructures
14 
15 // Consumers
19 
20 // Helpers
24 
28 
29 #ifdef _OPENMP
30 #include <omp.h>
31 #endif
32 
33 namespace OpenMS
34 {
35 
73  class OPENMS_DLLAPI FullSwathFileConsumer :
75  {
76 
77 public:
78  typedef PeakMap MapType;
81 
83  ms1_map_(), // initialize to null
84  consuming_possible_(true),
85  use_external_boundaries_(false),
86  correct_window_counter_(0)
87  {
88  use_external_boundaries_ = !swath_map_boundaries_.empty();
89  }
90 
98  FullSwathFileConsumer(std::vector<OpenSwath::SwathMap> swath_boundaries) :
99  swath_map_boundaries_(swath_boundaries),
100  ms1_map_(), // initialize to null
101  consuming_possible_(true),
102  use_external_boundaries_(false),
103  correct_window_counter_(0)
104  {
105  use_external_boundaries_ = !swath_map_boundaries_.empty();
106  }
107 
109 
110  void setExpectedSize(Size, Size) override {}
111  void setExperimentalSettings(const ExperimentalSettings& exp) override {settings_ = exp; }
112 
124  void retrieveSwathMaps(std::vector<OpenSwath::SwathMap>& maps)
125  {
126  consuming_possible_ = false; // make consumption of further spectra / chromatograms impossible
127  ensureMapsAreFilled_();
128  if (ms1_map_)
129  {
132  map.lower = -1;
133  map.upper = -1;
134  map.center = -1;
135  map.imLower = -1;
136  map.imUpper = -1;
137  map.ms1 = true;
138  maps.push_back(map);
139  }
140 
141  // Print warning if the lower/upper window could not be determined and we
142  // required manual determination of the boundaries.
143  if (!use_external_boundaries_ && correct_window_counter_ != swath_maps_.size())
144  {
145  std::cout << "WARNING: Could not correctly read the upper/lower limits of the SWATH windows from your input file. Read " <<
146  correct_window_counter_ << " correct (non-zero) window limits (expected " << swath_maps_.size() << " windows)." << std::endl;
147  }
148 
149  size_t nonempty_maps = 0;
150  for (Size i = 0; i < swath_maps_.size(); i++)
151  {
154  map.lower = swath_map_boundaries_[i].lower;
155  map.upper = swath_map_boundaries_[i].upper;
156  map.center = swath_map_boundaries_[i].center;
157  map.imLower = swath_map_boundaries_[i].imLower;
158  map.imUpper = swath_map_boundaries_[i].imUpper;
159  map.ms1 = false;
160  maps.push_back(map);
161  if (map.sptr->getNrSpectra() > 0) {nonempty_maps++;}
162  }
163 
164  if (nonempty_maps != swath_map_boundaries_.size())
165  {
166  std::cout << "WARNING: The number nonempty maps found in the input file (" << nonempty_maps << ") is not equal to the number of provided swath window boundaries (" <<
167  swath_map_boundaries_.size() << "). Please check your input." << std::endl;
168  }
169 
170  }
171 
174  {
175  std::cerr << "Read chromatogram while reading SWATH files, did not expect that!" << std::endl;
176  }
177 
184  {
185 
186  if (!consuming_possible_)
187  {
188  throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
189  "FullSwathFileConsumer cannot consume any more spectra after retrieveSwathMaps has been called already");
190  }
191 
192  if (s.getMSLevel() == 1)
193  {
194  consumeMS1Spectrum_(s);
195  }
196  else
197  {
198  if (s.getPrecursors().empty())
199  {
200  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
201  "Swath scan does not provide a precursor.");
202  }
203 
204  const std::vector<Precursor> prec = s.getPrecursors();
205  double center = prec[0].getMZ();
206  double lower = prec[0].getMZ() - prec[0].getIsolationWindowLowerOffset();
207  double upper = prec[0].getMZ() + prec[0].getIsolationWindowUpperOffset();
208 
209  double lowerIm = -1; // these initial values assume IM is not present
210  double upperIm = -1;
211 
212  // add IM if present
213  if (s.metaValueExists("ion mobility lower limit"))
214  {
215  lowerIm = s.getMetaValue("ion mobility lower limit"); // want this to be -1 if no ion mobility
216  upperIm = s.getMetaValue("ion mobility upper limit");
217  }
218 
219  bool found = false;
220 
221  // Check if enough information is present to infer the swath
222  if (center <= 0.0)
223  {
224  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
225  "Swath scan does not provide any precursor isolation information.");
226  }
227 
228  // try to match the current scan to one of the already known windows
229  for (Size i = 0; i < swath_map_boundaries_.size(); i++)
230  {
231  // We group by the precursor mz (center of the window) since this
232  // should be present in all SWATH scans.
233  // also specify ion mobility, if ion mobility not present will just be -1
234  if ( (std::fabs(center - swath_map_boundaries_[i].center) < 1e-6) && (std::fabs(lowerIm - swath_map_boundaries_[i].imLower) < 1e-6) && ( std::fabs(upperIm - swath_map_boundaries_[i].imUpper) < 1e-6))
235  {
236  found = true;
237  consumeSwathSpectrum_(s, i);
238  break;
239  }
240  }
241  if (!found)
242  {
243  if (use_external_boundaries_)
244  {
245  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
246  String("Encountered SWATH scan with boundary ") + center + " m/z which was not present in the provided windows.");
247  }
248  else
249  {
250  consumeSwathSpectrum_(s, swath_map_boundaries_.size());
251 
252  // we found a new SWATH window
253  if (lower > 0.0 && upper > 0.0)
254  {correct_window_counter_++;}
255 
256  OpenSwath::SwathMap boundary;
257  boundary.lower = lower;
258  boundary.upper = upper;
259  boundary.center = center;
260  boundary.imLower = lowerIm;
261  boundary.imUpper = upperIm;
262  swath_map_boundaries_.push_back(boundary);
263 
264  OPENMS_LOG_DEBUG << "Adding Swath centered at " << center
265  << " m/z with an isolation window of " << lower << " to " << upper
266  << " m/z and IM lower limit of " << lowerIm << " and upper limit of " << upperIm << std::endl;
267  }
268  }
269  }
270  }
271 
272 protected:
273 
281  virtual void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) = 0;
282 
290 
296  virtual void ensureMapsAreFilled_() = 0;
297 
299  std::vector<OpenSwath::SwathMap> swath_map_boundaries_;
300 
302  std::vector<boost::shared_ptr<PeakMap > > swath_maps_;
303  boost::shared_ptr<PeakMap > ms1_map_;
304 
306  // (MSExperiment has no constructor using ExperimentalSettings)
308 
311 
314 
317 
318  };
319 
326  class OPENMS_DLLAPI RegularSwathFileConsumer :
327  public FullSwathFileConsumer
328  {
329 
330 public:
331  typedef PeakMap MapType;
334 
336 
337  RegularSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries) :
338  FullSwathFileConsumer(known_window_boundaries) {}
339 
340 protected:
342  {
343  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
344  swath_maps_.push_back(exp);
345  }
346 
347  void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
348  {
349  while (swath_maps_.size() <= swath_nr)
350  {
351  addNewSwathMap_();
352  }
353 
354  swath_maps_[swath_nr]->addSpectrum(s);
355  }
356 
357  void addMS1Map_()
358  {
359  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
360  ms1_map_ = exp;
361  }
362 
364  {
365  if (!ms1_map_)
366  {
367  addMS1Map_();
368  }
369  ms1_map_->addSpectrum(s);
370  }
371 
372  void ensureMapsAreFilled_() override {}
373  };
374 
384  class OPENMS_DLLAPI CachedSwathFileConsumer :
385  public FullSwathFileConsumer
386  {
387 
388 public:
389  typedef PeakMap MapType;
392 
393  CachedSwathFileConsumer(String cachedir, String basename, Size nr_ms1_spectra, std::vector<int> nr_ms2_spectra) :
394  ms1_consumer_(nullptr),
395  swath_consumers_(),
396  cachedir_(cachedir),
397  basename_(basename),
398  nr_ms1_spectra_(nr_ms1_spectra),
399  nr_ms2_spectra_(nr_ms2_spectra)
400  {}
401 
402  CachedSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries,
403  String cachedir, String basename, Size nr_ms1_spectra, std::vector<int> nr_ms2_spectra) :
404  FullSwathFileConsumer(known_window_boundaries),
405  ms1_consumer_(nullptr),
406  swath_consumers_(),
407  cachedir_(cachedir),
408  basename_(basename),
409  nr_ms1_spectra_(nr_ms1_spectra),
410  nr_ms2_spectra_(nr_ms2_spectra)
411  {}
412 
414  {
415  // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
416  while (!swath_consumers_.empty())
417  {
418  delete swath_consumers_.back();
419  swath_consumers_.pop_back();
420  }
421  if (ms1_consumer_ != nullptr)
422  {
423  delete ms1_consumer_;
424  ms1_consumer_ = nullptr;
425  }
426  }
427 
428 protected:
430  {
431  String meta_file = cachedir_ + basename_ + "_" + String(swath_consumers_.size()) + ".mzML";
432  String cached_file = meta_file + ".cached";
433  MSDataCachedConsumer* consumer = new MSDataCachedConsumer(cached_file, true);
434  consumer->setExpectedSize(nr_ms2_spectra_[swath_consumers_.size()], 0);
435  swath_consumers_.push_back(consumer);
436 
437  // maps for meta data
438  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
439  swath_maps_.push_back(exp);
440  }
441 
442  void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
443  {
444  while (swath_maps_.size() <= swath_nr)
445  {
446  addNewSwathMap_();
447  }
448  swath_consumers_[swath_nr]->consumeSpectrum(s); // write data to cached file; clear data from spectrum s
449  swath_maps_[swath_nr]->addSpectrum(s); // append for the metadata (actual data was deleted)
450  }
451 
452  void addMS1Map_()
453  {
454  String meta_file = cachedir_ + basename_ + "_ms1.mzML";
455  String cached_file = meta_file + ".cached";
456  ms1_consumer_ = new MSDataCachedConsumer(cached_file, true);
457  ms1_consumer_->setExpectedSize(nr_ms1_spectra_, 0);
458  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
459  ms1_map_ = exp;
460  }
461 
463  {
464  if (ms1_consumer_ == nullptr)
465  {
466  addMS1Map_();
467  }
468  ms1_consumer_->consumeSpectrum(s);
469  ms1_map_->addSpectrum(s); // append for the metadata (actual data is deleted)
470  }
471 
472  void ensureMapsAreFilled_() override
473  {
474  size_t swath_consumers_size = swath_consumers_.size();
475  bool have_ms1 = (ms1_consumer_ != nullptr);
476 
477  // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
478  // The file streams to the cached data on disc can and should be closed
479  // here safely. Since ensureMapsAreFilled_ is called after consuming all
480  // the spectra, there will be no more spectra to append but the client
481  // might already want to read after this call, so all data needs to be
482  // present on disc and the file streams closed.
483  //
484  // TODO merge with destructor code into own function!
485  while (!swath_consumers_.empty())
486  {
487  delete swath_consumers_.back();
488  swath_consumers_.pop_back();
489  }
490  if (ms1_consumer_ != nullptr)
491  {
492  delete ms1_consumer_;
493  ms1_consumer_ = nullptr;
494  }
495 
496  if (have_ms1)
497  {
498  boost::shared_ptr<PeakMap > exp(new PeakMap);
499  String meta_file = cachedir_ + basename_ + "_ms1.mzML";
500  // write metadata to disk and store the correct data processing tag
501  Internal::CachedMzMLHandler().writeMetadata(*ms1_map_, meta_file, true);
502  MzMLFile().load(meta_file, *exp.get());
503  ms1_map_ = exp;
504  }
505 
506 #ifdef _OPENMP
507 #pragma omp parallel for
508 #endif
509  for (SignedSize i = 0; i < boost::numeric_cast<SignedSize>(swath_consumers_size); i++)
510  {
511  boost::shared_ptr<PeakMap > exp(new PeakMap);
512  String meta_file = cachedir_ + basename_ + "_" + String(i) + ".mzML";
513  // write metadata to disk and store the correct data processing tag
514  Internal::CachedMzMLHandler().writeMetadata(*swath_maps_[i], meta_file, true);
515  MzMLFile().load(meta_file, *exp.get());
516  swath_maps_[i] = exp;
517  }
518  }
519 
521  std::vector<MSDataCachedConsumer*> swath_consumers_;
522 
526  std::vector<int> nr_ms2_spectra_;
527  };
528 
541  class OPENMS_DLLAPI MzMLSwathFileConsumer :
542  public FullSwathFileConsumer
543  {
544 
545 public:
546  typedef PeakMap MapType;
549 
550  MzMLSwathFileConsumer(const String& cachedir, const String& basename, Size nr_ms1_spectra, const std::vector<int>& nr_ms2_spectra) :
551  ms1_consumer_(nullptr),
552  swath_consumers_(),
553  cachedir_(cachedir),
554  basename_(basename),
555  nr_ms1_spectra_(nr_ms1_spectra),
556  nr_ms2_spectra_(nr_ms2_spectra)
557  {}
558 
559  MzMLSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries,
560  const String& cachedir, const String& basename, Size nr_ms1_spectra, const std::vector<int>& nr_ms2_spectra) :
561  FullSwathFileConsumer(known_window_boundaries),
562  ms1_consumer_(nullptr),
563  swath_consumers_(),
564  cachedir_(cachedir),
565  basename_(basename),
566  nr_ms1_spectra_(nr_ms1_spectra),
567  nr_ms2_spectra_(nr_ms2_spectra)
568  {}
569 
571  {
572  deleteSetNull_();
573  }
574 
575 protected:
576 
578  {
579  // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
580  while (!swath_consumers_.empty())
581  {
582  delete swath_consumers_.back();
583  swath_consumers_.pop_back();
584  }
585  if (ms1_consumer_ != nullptr)
586  {
587  delete ms1_consumer_;
588  ms1_consumer_ = nullptr;
589  }
590  }
591 
593  {
594  String mzml_file = cachedir_ + basename_ + "_" + String(swath_consumers_.size()) + ".mzML";
595  PlainMSDataWritingConsumer* consumer = new PlainMSDataWritingConsumer(mzml_file);
596  consumer->getOptions().setCompression(true);
597  consumer->setExpectedSize(nr_ms2_spectra_[swath_consumers_.size()], 0);
598  swath_consumers_.push_back(consumer);
599  }
600 
601  void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
602  {
603  // only use swath_consumers_ to count how many we have already added
604  while (swath_consumers_.size() <= swath_nr)
605  {
606  addNewSwathMap_();
607  }
608  swath_consumers_[swath_nr]->consumeSpectrum(s);
609  s.clear(false);
610  }
611 
612  void addMS1Map_()
613  {
614  String mzml_file = cachedir_ + basename_ + "_ms1.mzML";
615  ms1_consumer_ = new PlainMSDataWritingConsumer(mzml_file);
616  ms1_consumer_->setExpectedSize(nr_ms1_spectra_, 0);
617  ms1_consumer_->getOptions().setCompression(true);
618  }
619 
621  {
622  if (ms1_consumer_ == nullptr)
623  {
624  addMS1Map_();
625  }
626  ms1_consumer_->consumeSpectrum(s);
627  }
628 
629  void ensureMapsAreFilled_() override
630  {
631  deleteSetNull_();
632  }
633 
635  std::vector<PlainMSDataWritingConsumer*> swath_consumers_;
636 
640  std::vector<int> nr_ms2_spectra_;
641  };
642 
643 }
644 
#define OPENMS_LOG_DEBUG
Macro for general debugging information.
Definition: LogStream.h:454
On-disk cached implementation of FullSwathFileConsumer.
Definition: SwathFileConsumer.h:386
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:462
std::vector< MSDataCachedConsumer * > swath_consumers_
Definition: SwathFileConsumer.h:521
void addMS1Map_()
Definition: SwathFileConsumer.h:452
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:472
CachedSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries, String cachedir, String basename, Size nr_ms1_spectra, std::vector< int > nr_ms2_spectra)
Definition: SwathFileConsumer.h:402
String basename_
Definition: SwathFileConsumer.h:524
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:391
std::vector< int > nr_ms2_spectra_
Definition: SwathFileConsumer.h:526
~CachedSwathFileConsumer() override
Definition: SwathFileConsumer.h:413
MSDataCachedConsumer * ms1_consumer_
Definition: SwathFileConsumer.h:520
PeakMap MapType
Definition: SwathFileConsumer.h:389
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:442
String cachedir_
Definition: SwathFileConsumer.h:523
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:390
CachedSwathFileConsumer(String cachedir, String basename, Size nr_ms1_spectra, std::vector< int > nr_ms2_spectra)
Definition: SwathFileConsumer.h:393
void addNewSwathMap_()
Definition: SwathFileConsumer.h:429
int nr_ms1_spectra_
Definition: SwathFileConsumer.h:525
A method or algorithm argument contains illegal values.
Definition: Exception.h:624
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition: Exception.h:315
Description of the experimental settings.
Definition: ExperimentalSettings.h:36
Abstract base class which can consume spectra coming from SWATH experiment stored in a single file.
Definition: SwathFileConsumer.h:75
size_t correct_window_counter_
How many windows were correctly annotated (non-zero window limits)
Definition: SwathFileConsumer.h:316
FullSwathFileConsumer(std::vector< OpenSwath::SwathMap > swath_boundaries)
Constructor.
Definition: SwathFileConsumer.h:98
~FullSwathFileConsumer() override
Definition: SwathFileConsumer.h:108
bool consuming_possible_
Whether further spectra can still be consumed.
Definition: SwathFileConsumer.h:310
FullSwathFileConsumer()
Definition: SwathFileConsumer.h:82
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:80
std::vector< boost::shared_ptr< PeakMap > > swath_maps_
A list of SWATH maps and the MS1 map.
Definition: SwathFileConsumer.h:302
PeakMap settings_
The Experimental settings.
Definition: SwathFileConsumer.h:307
void setExpectedSize(Size, Size) override
Set expected size of spectra and chromatograms to be consumed.
Definition: SwathFileConsumer.h:110
virtual void consumeMS1Spectrum_(MapType::SpectrumType &s)=0
Consume an MS1 spectrum.
boost::shared_ptr< PeakMap > ms1_map_
Definition: SwathFileConsumer.h:303
virtual void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr)=0
Consume an MS2 spectrum belonging to SWATH "swath_nr".
PeakMap MapType
Definition: SwathFileConsumer.h:78
void consumeChromatogram(MapType::ChromatogramType &) override
Consume a chromatogram -> should not happen when dealing with SWATH maps.
Definition: SwathFileConsumer.h:173
std::vector< OpenSwath::SwathMap > swath_map_boundaries_
A list of Swath map identifiers (lower/upper boundary and center)
Definition: SwathFileConsumer.h:299
void retrieveSwathMaps(std::vector< OpenSwath::SwathMap > &maps)
Populate the vector of swath maps after consuming all spectra.
Definition: SwathFileConsumer.h:124
void setExperimentalSettings(const ExperimentalSettings &exp) override
Set experimental settings (meta-data) of the data to be consumed.
Definition: SwathFileConsumer.h:111
void consumeSpectrum(MapType::SpectrumType &s) override
* Consume a spectrum which may belong either to an MS1 scan or one of n MS2 (SWATH) scans
Definition: SwathFileConsumer.h:183
bool use_external_boundaries_
Whether to use external input for SWATH boundaries.
Definition: SwathFileConsumer.h:313
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:79
virtual void ensureMapsAreFilled_()=0
Callback function after the reading is complete.
The interface of a consumer of spectra and chromatograms.
Definition: IMSDataConsumer.h:44
An class that uses on-disk caching to read and write spectra and chromatograms.
Definition: CachedMzMLHandler.h:42
void writeMetadata(MapType exp, const String &out_meta, bool addCacheMetaValue=false)
Write only the meta data of an MSExperiment.
PeakFileOptions & getOptions()
Get the peak file options.
The representation of a chromatogram.
Definition: MSChromatogram.h:31
Transforming and cached writing consumer of MS data.
Definition: MSDataCachedConsumer.h:31
void setExpectedSize(Size, Size) override
Set expected size of spectra and chromatograms to be consumed.
Definition: MSDataCachedConsumer.h:74
void setExpectedSize(Size expectedSpectra, Size expectedChromatograms) override
Set expected size of spectra and chromatograms to be written.
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
UInt getMSLevel() const
Returns the MS level.
void clear(bool clear_meta_data)
Clears all data and meta data.
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.
File adapter for MzML files.
Definition: MzMLFile.h:34
void load(const String &filename, PeakMap &map)
Loads a map from a MzML file. Spectra and chromatograms are sorted by default (this can be disabled u...
On-disk mzML implementation of FullSwathFileConsumer.
Definition: SwathFileConsumer.h:543
std::vector< PlainMSDataWritingConsumer * > swath_consumers_
Definition: SwathFileConsumer.h:635
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:620
PlainMSDataWritingConsumer * ms1_consumer_
Definition: SwathFileConsumer.h:634
void addMS1Map_()
Definition: SwathFileConsumer.h:612
MzMLSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries, const String &cachedir, const String &basename, Size nr_ms1_spectra, const std::vector< int > &nr_ms2_spectra)
Definition: SwathFileConsumer.h:559
~MzMLSwathFileConsumer() override
Definition: SwathFileConsumer.h:570
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:629
MzMLSwathFileConsumer(const String &cachedir, const String &basename, Size nr_ms1_spectra, const std::vector< int > &nr_ms2_spectra)
Definition: SwathFileConsumer.h:550
String basename_
Definition: SwathFileConsumer.h:638
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:548
std::vector< int > nr_ms2_spectra_
Definition: SwathFileConsumer.h:640
PeakMap MapType
Definition: SwathFileConsumer.h:546
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:601
String cachedir_
Definition: SwathFileConsumer.h:637
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:547
void addNewSwathMap_()
Definition: SwathFileConsumer.h:592
int nr_ms1_spectra_
Definition: SwathFileConsumer.h:639
void deleteSetNull_()
Definition: SwathFileConsumer.h:577
void setCompression(bool compress)
Consumer class that writes MS data to disk using the mzML format.
Definition: MSDataWritingConsumer.h:216
In-memory implementation of FullSwathFileConsumer.
Definition: SwathFileConsumer.h:328
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:363
RegularSwathFileConsumer()
Definition: SwathFileConsumer.h:335
void addMS1Map_()
Definition: SwathFileConsumer.h:357
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:372
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:333
PeakMap MapType
Definition: SwathFileConsumer.h:331
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:347
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:332
void addNewSwathMap_()
Definition: SwathFileConsumer.h:341
RegularSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries)
Definition: SwathFileConsumer.h:337
static OpenSwath::SpectrumAccessPtr getSpectrumAccessOpenMSPtr(const boost::shared_ptr< OpenMS::PeakMap > &exp)
Simple Factory method to get a SpectrumAccess Ptr from an MSExperiment.
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
A more convenient string class.
Definition: String.h:34
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:108
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
MSExperiment PeakMap
Two-dimensional map of raw data points or peaks.
Definition: StandardTypes.h:35
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Data structure to hold one SWATH map with information about upper / lower isolation window and whethe...
Definition: SwathMap.h:20
bool ms1
Definition: SwathMap.h:27
double imUpper
Definition: SwathMap.h:26
OpenSwath::SpectrumAccessPtr sptr
Definition: SwathMap.h:21
double center
Definition: SwathMap.h:24
double lower
Definition: SwathMap.h:22
double imLower
Definition: SwathMap.h:25
double upper
Definition: SwathMap.h:23