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