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