OpenMS  2.7.0
SwathFileConsumer.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-2021.
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: Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <boost/cast.hpp>
38 
39 // Datastructures
42 
43 // Consumers
47 
48 // Helpers
51 
55 
56 #ifdef _OPENMP
57 #include <omp.h>
58 #endif
59 
60 namespace OpenMS
61 {
62 
100  class OPENMS_DLLAPI FullSwathFileConsumer :
102  {
103 
104 public:
105  typedef PeakMap MapType;
108 
110  ms1_map_(), // initialize to null
111  consuming_possible_(true),
112  use_external_boundaries_(false),
113  correct_window_counter_(0)
114  {
115  use_external_boundaries_ = !swath_map_boundaries_.empty();
116  }
117 
125  FullSwathFileConsumer(std::vector<OpenSwath::SwathMap> swath_boundaries) :
126  swath_map_boundaries_(swath_boundaries),
127  ms1_map_(), // initialize to null
128  consuming_possible_(true),
129  use_external_boundaries_(false),
130  correct_window_counter_(0)
131  {
132  use_external_boundaries_ = !swath_map_boundaries_.empty();
133  }
134 
136 
137  void setExpectedSize(Size, Size) override {}
138  void setExperimentalSettings(const ExperimentalSettings& exp) override {settings_ = exp; }
139 
151  void retrieveSwathMaps(std::vector<OpenSwath::SwathMap>& maps)
152  {
153  consuming_possible_ = false; // make consumption of further spectra / chromatograms impossible
154  ensureMapsAreFilled_();
155  if (ms1_map_)
156  {
159  map.lower = -1;
160  map.upper = -1;
161  map.center = -1;
162  map.ms1 = true;
163  maps.push_back(map);
164  }
165 
166  // Print warning if the lower/upper window could not be determined and we
167  // required manual determination of the boundaries.
168  if (!use_external_boundaries_ && correct_window_counter_ != swath_maps_.size())
169  {
170  std::cout << "WARNING: Could not correctly read the upper/lower limits of the SWATH windows from your input file. Read " <<
171  correct_window_counter_ << " correct (non-zero) window limits (expected " << swath_maps_.size() << " windows)." << std::endl;
172  }
173 
174  size_t nonempty_maps = 0;
175  for (Size i = 0; i < swath_maps_.size(); i++)
176  {
179  map.lower = swath_map_boundaries_[i].lower;
180  map.upper = swath_map_boundaries_[i].upper;
181  map.center = swath_map_boundaries_[i].center;
182  map.ms1 = false;
183  maps.push_back(map);
184  if (map.sptr->getNrSpectra() > 0) {nonempty_maps++;}
185  }
186 
187  if (nonempty_maps != swath_map_boundaries_.size())
188  {
189  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 (" <<
190  swath_map_boundaries_.size() << "). Please check your input." << std::endl;
191  }
192 
193  }
194 
197  {
198  std::cerr << "Read chromatogram while reading SWATH files, did not expect that!" << std::endl;
199  }
200 
207  {
208  if (!consuming_possible_)
209  {
210  throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
211  "FullSwathFileConsumer cannot consume any more spectra after retrieveSwathMaps has been called already");
212  }
213 
214  if (s.getMSLevel() == 1)
215  {
216  consumeMS1Spectrum_(s);
217  }
218  else
219  {
220  if (s.getPrecursors().empty())
221  {
222  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
223  "Swath scan does not provide a precursor.");
224  }
225 
226  const std::vector<Precursor> prec = s.getPrecursors();
227  double center = prec[0].getMZ();
228  double lower = prec[0].getMZ() - prec[0].getIsolationWindowLowerOffset();
229  double upper = prec[0].getMZ() + prec[0].getIsolationWindowUpperOffset();
230  bool found = false;
231 
232  // Check if enough information is present to infer the swath
233  if (center <= 0.0)
234  {
235  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
236  "Swath scan does not provide any precursor isolation information.");
237  }
238 
239  // try to match the current scan to one of the already known windows
240  for (Size i = 0; i < swath_map_boundaries_.size(); i++)
241  {
242  // We group by the precursor mz (center of the window) since this
243  // should be present in all SWATH scans.
244  if (std::fabs(center - swath_map_boundaries_[i].center) < 1e-6)
245  {
246  found = true;
247  consumeSwathSpectrum_(s, i);
248  break;
249  }
250  }
251  if (!found)
252  {
253  if (use_external_boundaries_)
254  {
255  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
256  String("Encountered SWATH scan with boundary ") + center + " m/z which was not present in the provided windows.");
257  }
258  else
259  {
260  consumeSwathSpectrum_(s, swath_map_boundaries_.size());
261 
262  // we found a new SWATH window
263  if (lower > 0.0 && upper > 0.0)
264  {correct_window_counter_++;}
265 
266  OpenSwath::SwathMap boundary;
267  boundary.lower = lower;
268  boundary.upper = upper;
269  boundary.center = center;
270  swath_map_boundaries_.push_back(boundary);
271 
272  OPENMS_LOG_DEBUG << "Adding Swath centered at " << center
273  << " m/z with an isolation window of " << lower << " to " << upper
274  << " m/z." << std::endl;
275  }
276  }
277  }
278  }
279 
280 protected:
281 
289  virtual void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) = 0;
290 
298 
304  virtual void ensureMapsAreFilled_() = 0;
305 
307  std::vector<OpenSwath::SwathMap> swath_map_boundaries_;
308 
310  std::vector<boost::shared_ptr<PeakMap > > swath_maps_;
311  boost::shared_ptr<PeakMap > ms1_map_;
312 
314  // (MSExperiment has no constructor using ExperimentalSettings)
316 
319 
322 
325 
326  };
327 
334  class OPENMS_DLLAPI RegularSwathFileConsumer :
335  public FullSwathFileConsumer
336  {
337 
338 public:
339  typedef PeakMap MapType;
342 
344 
345  RegularSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries) :
346  FullSwathFileConsumer(known_window_boundaries) {}
347 
348 protected:
350  {
351  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
352  swath_maps_.push_back(exp);
353  }
354 
355  void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
356  {
357  while (swath_maps_.size() <= swath_nr)
358  {
359  addNewSwathMap_();
360  }
361 
362  swath_maps_[swath_nr]->addSpectrum(s);
363  }
364 
365  void addMS1Map_()
366  {
367  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
368  ms1_map_ = exp;
369  }
370 
372  {
373  if (!ms1_map_)
374  {
375  addMS1Map_();
376  }
377  ms1_map_->addSpectrum(s);
378  }
379 
380  void ensureMapsAreFilled_() override {}
381  };
382 
392  class OPENMS_DLLAPI CachedSwathFileConsumer :
393  public FullSwathFileConsumer
394  {
395 
396 public:
397  typedef PeakMap MapType;
400 
401  CachedSwathFileConsumer(String cachedir, String basename, Size nr_ms1_spectra, std::vector<int> nr_ms2_spectra) :
402  ms1_consumer_(nullptr),
403  swath_consumers_(),
404  cachedir_(cachedir),
405  basename_(basename),
406  nr_ms1_spectra_(nr_ms1_spectra),
407  nr_ms2_spectra_(nr_ms2_spectra)
408  {}
409 
410  CachedSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries,
411  String cachedir, String basename, Size nr_ms1_spectra, std::vector<int> nr_ms2_spectra) :
412  FullSwathFileConsumer(known_window_boundaries),
413  ms1_consumer_(nullptr),
414  swath_consumers_(),
415  cachedir_(cachedir),
416  basename_(basename),
417  nr_ms1_spectra_(nr_ms1_spectra),
418  nr_ms2_spectra_(nr_ms2_spectra)
419  {}
420 
422  {
423  // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
424  while (!swath_consumers_.empty())
425  {
426  delete swath_consumers_.back();
427  swath_consumers_.pop_back();
428  }
429  if (ms1_consumer_ != nullptr)
430  {
431  delete ms1_consumer_;
432  ms1_consumer_ = nullptr;
433  }
434  }
435 
436 protected:
438  {
439  String meta_file = cachedir_ + basename_ + "_" + String(swath_consumers_.size()) + ".mzML";
440  String cached_file = meta_file + ".cached";
441  MSDataCachedConsumer* consumer = new MSDataCachedConsumer(cached_file, true);
442  consumer->setExpectedSize(nr_ms2_spectra_[swath_consumers_.size()], 0);
443  swath_consumers_.push_back(consumer);
444 
445  // maps for meta data
446  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
447  swath_maps_.push_back(exp);
448  }
449 
450  void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
451  {
452  while (swath_maps_.size() <= swath_nr)
453  {
454  addNewSwathMap_();
455  }
456  swath_consumers_[swath_nr]->consumeSpectrum(s); // write data to cached file; clear data from spectrum s
457  swath_maps_[swath_nr]->addSpectrum(s); // append for the metadata (actual data was deleted)
458  }
459 
460  void addMS1Map_()
461  {
462  String meta_file = cachedir_ + basename_ + "_ms1.mzML";
463  String cached_file = meta_file + ".cached";
464  ms1_consumer_ = new MSDataCachedConsumer(cached_file, true);
465  ms1_consumer_->setExpectedSize(nr_ms1_spectra_, 0);
466  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
467  ms1_map_ = exp;
468  }
469 
471  {
472  if (ms1_consumer_ == nullptr)
473  {
474  addMS1Map_();
475  }
476  ms1_consumer_->consumeSpectrum(s);
477  ms1_map_->addSpectrum(s); // append for the metadata (actual data is deleted)
478  }
479 
480  void ensureMapsAreFilled_() override
481  {
482  size_t swath_consumers_size = swath_consumers_.size();
483  bool have_ms1 = (ms1_consumer_ != nullptr);
484 
485  // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
486  // The file streams to the cached data on disc can and should be closed
487  // here safely. Since ensureMapsAreFilled_ is called after consuming all
488  // the spectra, there will be no more spectra to append but the client
489  // might already want to read after this call, so all data needs to be
490  // present on disc and the file streams closed.
491  //
492  // TODO merge with destructor code into own function!
493  while (!swath_consumers_.empty())
494  {
495  delete swath_consumers_.back();
496  swath_consumers_.pop_back();
497  }
498  if (ms1_consumer_ != nullptr)
499  {
500  delete ms1_consumer_;
501  ms1_consumer_ = nullptr;
502  }
503 
504  if (have_ms1)
505  {
506  boost::shared_ptr<PeakMap > exp(new PeakMap);
507  String meta_file = cachedir_ + basename_ + "_ms1.mzML";
508  // write metadata to disk and store the correct data processing tag
509  Internal::CachedMzMLHandler().writeMetadata(*ms1_map_, meta_file, true);
510  MzMLFile().load(meta_file, *exp.get());
511  ms1_map_ = exp;
512  }
513 
514 #ifdef _OPENMP
515 #pragma omp parallel for
516 #endif
517  for (SignedSize i = 0; i < boost::numeric_cast<SignedSize>(swath_consumers_size); i++)
518  {
519  boost::shared_ptr<PeakMap > exp(new PeakMap);
520  String meta_file = cachedir_ + basename_ + "_" + String(i) + ".mzML";
521  // write metadata to disk and store the correct data processing tag
522  Internal::CachedMzMLHandler().writeMetadata(*swath_maps_[i], meta_file, true);
523  MzMLFile().load(meta_file, *exp.get());
524  swath_maps_[i] = exp;
525  }
526  }
527 
529  std::vector<MSDataCachedConsumer*> swath_consumers_;
530 
534  std::vector<int> nr_ms2_spectra_;
535  };
536 
549  class OPENMS_DLLAPI MzMLSwathFileConsumer :
550  public FullSwathFileConsumer
551  {
552 
553 public:
554  typedef PeakMap MapType;
557 
558  MzMLSwathFileConsumer(const String& cachedir, const String& basename, Size nr_ms1_spectra, const std::vector<int>& nr_ms2_spectra) :
559  ms1_consumer_(nullptr),
560  swath_consumers_(),
561  cachedir_(cachedir),
562  basename_(basename),
563  nr_ms1_spectra_(nr_ms1_spectra),
564  nr_ms2_spectra_(nr_ms2_spectra)
565  {}
566 
567  MzMLSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries,
568  const String& cachedir, const String& basename, Size nr_ms1_spectra, const std::vector<int>& nr_ms2_spectra) :
569  FullSwathFileConsumer(known_window_boundaries),
570  ms1_consumer_(nullptr),
571  swath_consumers_(),
572  cachedir_(cachedir),
573  basename_(basename),
574  nr_ms1_spectra_(nr_ms1_spectra),
575  nr_ms2_spectra_(nr_ms2_spectra)
576  {}
577 
579  {
580  deleteSetNull_();
581  }
582 
583 protected:
584 
586  {
587  // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
588  while (!swath_consumers_.empty())
589  {
590  delete swath_consumers_.back();
591  swath_consumers_.pop_back();
592  }
593  if (ms1_consumer_ != nullptr)
594  {
595  delete ms1_consumer_;
596  ms1_consumer_ = nullptr;
597  }
598  }
599 
601  {
602  String mzml_file = cachedir_ + basename_ + "_" + String(swath_consumers_.size()) + ".mzML";
603  PlainMSDataWritingConsumer* consumer = new PlainMSDataWritingConsumer(mzml_file);
604  consumer->getOptions().setCompression(true);
605  consumer->setExpectedSize(nr_ms2_spectra_[swath_consumers_.size()], 0);
606  swath_consumers_.push_back(consumer);
607  }
608 
609  void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
610  {
611  // only use swath_consumers_ to count how many we have already added
612  while (swath_consumers_.size() <= swath_nr)
613  {
614  addNewSwathMap_();
615  }
616  swath_consumers_[swath_nr]->consumeSpectrum(s);
617  s.clear(false);
618  }
619 
620  void addMS1Map_()
621  {
622  String mzml_file = cachedir_ + basename_ + "_ms1.mzML";
623  ms1_consumer_ = new PlainMSDataWritingConsumer(mzml_file);
624  ms1_consumer_->setExpectedSize(nr_ms1_spectra_, 0);
625  ms1_consumer_->getOptions().setCompression(true);
626  }
627 
629  {
630  if (ms1_consumer_ == nullptr)
631  {
632  addMS1Map_();
633  }
634  ms1_consumer_->consumeSpectrum(s);
635  }
636 
637  void ensureMapsAreFilled_() override
638  {
639  deleteSetNull_();
640  }
641 
643  std::vector<PlainMSDataWritingConsumer*> swath_consumers_;
644 
648  std::vector<int> nr_ms2_spectra_;
649  };
650 
651 }
652 
#define OPENMS_LOG_DEBUG
Macro for general debugging information.
Definition: LogStream.h:470
On-disk cached implementation of FullSwathFileConsumer.
Definition: SwathFileConsumer.h:394
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:470
std::vector< MSDataCachedConsumer * > swath_consumers_
Definition: SwathFileConsumer.h:529
void addMS1Map_()
Definition: SwathFileConsumer.h:460
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:480
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:410
String basename_
Definition: SwathFileConsumer.h:532
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:399
std::vector< int > nr_ms2_spectra_
Definition: SwathFileConsumer.h:534
~CachedSwathFileConsumer() override
Definition: SwathFileConsumer.h:421
MSDataCachedConsumer * ms1_consumer_
Definition: SwathFileConsumer.h:528
PeakMap MapType
Definition: SwathFileConsumer.h:397
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:450
String cachedir_
Definition: SwathFileConsumer.h:531
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:398
CachedSwathFileConsumer(String cachedir, String basename, Size nr_ms1_spectra, std::vector< int > nr_ms2_spectra)
Definition: SwathFileConsumer.h:401
void addNewSwathMap_()
Definition: SwathFileConsumer.h:437
int nr_ms1_spectra_
Definition: SwathFileConsumer.h:533
A method or algorithm argument contains illegal values.
Definition: Exception.h:656
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition: Exception.h:341
Description of the experimental settings.
Definition: ExperimentalSettings.h:62
Abstract base class which can consume spectra coming from SWATH experiment stored in a single file.
Definition: SwathFileConsumer.h:102
size_t correct_window_counter_
How many windows were correctly annotated (non-zero window limits)
Definition: SwathFileConsumer.h:324
FullSwathFileConsumer(std::vector< OpenSwath::SwathMap > swath_boundaries)
Constructor.
Definition: SwathFileConsumer.h:125
~FullSwathFileConsumer() override
Definition: SwathFileConsumer.h:135
bool consuming_possible_
Whether further spectra can still be consumed.
Definition: SwathFileConsumer.h:318
FullSwathFileConsumer()
Definition: SwathFileConsumer.h:109
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:107
std::vector< boost::shared_ptr< PeakMap > > swath_maps_
A list of SWATH maps and the MS1 map.
Definition: SwathFileConsumer.h:310
PeakMap settings_
The Experimental settings.
Definition: SwathFileConsumer.h:315
void setExpectedSize(Size, Size) override
Set expected size of spectra and chromatograms to be consumed.
Definition: SwathFileConsumer.h:137
virtual void consumeMS1Spectrum_(MapType::SpectrumType &s)=0
Consume an MS1 spectrum.
boost::shared_ptr< PeakMap > ms1_map_
Definition: SwathFileConsumer.h:311
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:105
void consumeChromatogram(MapType::ChromatogramType &) override
Consume a chromatogram -> should not happen when dealing with SWATH maps.
Definition: SwathFileConsumer.h:196
std::vector< OpenSwath::SwathMap > swath_map_boundaries_
A list of Swath map identifiers (lower/upper boundary and center)
Definition: SwathFileConsumer.h:307
void retrieveSwathMaps(std::vector< OpenSwath::SwathMap > &maps)
Populate the vector of swath maps after consuming all spectra.
Definition: SwathFileConsumer.h:151
void setExperimentalSettings(const ExperimentalSettings &exp) override
Set experimental settings (meta-data) of the data to be consumed.
Definition: SwathFileConsumer.h:138
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:206
bool use_external_boundaries_
Whether to use external input for SWATH boundaries.
Definition: SwathFileConsumer.h:321
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:106
virtual void ensureMapsAreFilled_()=0
Callback function after the reading is complete.
The interface of a consumer of spectra and chromatograms.
Definition: IMSDataConsumer.h:70
An class that uses on-disk caching to read and write spectra and chromatograms.
Definition: CachedMzMLHandler.h:68
void writeMetadata(MapType exp, 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:58
Transforming and cached writing consumer of MS data.
Definition: MSDataCachedConsumer.h:57
void setExpectedSize(Size, Size) override
Set expected size of spectra and chromatograms to be consumed.
Definition: MSDataCachedConsumer.h:100
void setExpectedSize(Size expectedSpectra, Size expectedChromatograms) override
Set expected size of spectra and chromatograms to be written.
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:80
The representation of a 1D spectrum.
Definition: MSSpectrum.h:71
UInt getMSLevel() const
Returns the MS level.
void clear(bool clear_meta_data)
Clears all data and meta data.
File adapter for MzML files.
Definition: MzMLFile.h:58
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:551
std::vector< PlainMSDataWritingConsumer * > swath_consumers_
Definition: SwathFileConsumer.h:643
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:628
PlainMSDataWritingConsumer * ms1_consumer_
Definition: SwathFileConsumer.h:642
void addMS1Map_()
Definition: SwathFileConsumer.h:620
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:567
~MzMLSwathFileConsumer() override
Definition: SwathFileConsumer.h:578
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:637
MzMLSwathFileConsumer(const String &cachedir, const String &basename, Size nr_ms1_spectra, const std::vector< int > &nr_ms2_spectra)
Definition: SwathFileConsumer.h:558
String basename_
Definition: SwathFileConsumer.h:646
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:556
std::vector< int > nr_ms2_spectra_
Definition: SwathFileConsumer.h:648
PeakMap MapType
Definition: SwathFileConsumer.h:554
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:609
String cachedir_
Definition: SwathFileConsumer.h:645
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:555
void addNewSwathMap_()
Definition: SwathFileConsumer.h:600
int nr_ms1_spectra_
Definition: SwathFileConsumer.h:647
void deleteSetNull_()
Definition: SwathFileConsumer.h:585
void setCompression(bool compress)
Consumer class that writes MS data to disk using the mzML format.
Definition: MSDataWritingConsumer.h:242
In-memory implementation of FullSwathFileConsumer.
Definition: SwathFileConsumer.h:336
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:371
RegularSwathFileConsumer()
Definition: SwathFileConsumer.h:343
void addMS1Map_()
Definition: SwathFileConsumer.h:365
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:380
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:341
PeakMap MapType
Definition: SwathFileConsumer.h:339
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:355
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:340
void addNewSwathMap_()
Definition: SwathFileConsumer.h:349
RegularSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries)
Definition: SwathFileConsumer.h:345
static OpenSwath::SpectrumAccessPtr getSpectrumAccessOpenMSPtr(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:61
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
MSExperiment PeakMap
Two-dimensional map of raw data points or peaks.
Definition: StandardTypes.h:61
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Data structure to hold one SWATH map with information about upper / lower isolation window and whethe...
Definition: SwathMap.h:46
bool ms1
Definition: SwathMap.h:51
OpenSwath::SpectrumAccessPtr sptr
Definition: SwathMap.h:47
double center
Definition: SwathMap.h:50
double lower
Definition: SwathMap.h:48
double upper
Definition: SwathMap.h:49