Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
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-2017.
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 #ifndef OPENMS_FORMAT_DATAACCESS_SWATHFILECONSUMER_H
36 #define OPENMS_FORMAT_DATAACCESS_SWATHFILECONSUMER_H
37 
38 #include <boost/cast.hpp>
39 
40 // Datastructures
43 
44 // Consumers
48 
49 // Helpers
52 
56 
57 #ifdef _OPENMP
58 #include <omp.h>
59 #endif
60 
61 namespace OpenMS
62 {
63 
101  class OPENMS_DLLAPI FullSwathFileConsumer :
103  {
104 
105 public:
106  typedef PeakMap MapType;
109 
111  ms1_map_(), // initialize to null
112  consuming_possible_(true),
113  use_external_boundaries_(false),
114  correct_window_counter_(0)
115  {
116  use_external_boundaries_ = !swath_map_boundaries_.empty();
117  }
118 
126  FullSwathFileConsumer(std::vector<OpenSwath::SwathMap> swath_boundaries) :
127  swath_map_boundaries_(swath_boundaries),
128  ms1_map_(), // initialize to null
129  consuming_possible_(true),
130  use_external_boundaries_(false),
131  correct_window_counter_(0)
132  {
133  use_external_boundaries_ = !swath_map_boundaries_.empty();
134  }
135 
137 
139  void setExperimentalSettings(const ExperimentalSettings& exp) {settings_ = exp; }
140 
152  void retrieveSwathMaps(std::vector<OpenSwath::SwathMap>& maps)
153  {
154  consuming_possible_ = false; // make consumption of further spectra / chromatograms impossible
155  ensureMapsAreFilled_();
156  if (ms1_map_)
157  {
160  map.lower = -1;
161  map.upper = -1;
162  map.center = -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.ms1 = false;
184  maps.push_back(map);
185  if (map.sptr->getNrSpectra() > 0) {nonempty_maps++;}
186  }
187 
188  if (nonempty_maps != swath_map_boundaries_.size())
189  {
190  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 (" <<
191  swath_map_boundaries_.size() << "). Please check your input." << std::endl;
192  }
193 
194  }
195 
198  {
199  std::cerr << "Read chromatogram while reading SWATH files, did not expect that!" << std::endl;
200  }
201 
208  {
209  if (!consuming_possible_)
210  {
211  throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
212  "FullSwathFileConsumer cannot consume any more spectra after retrieveSwathMaps has been called already");
213  }
214 
215  if (s.getMSLevel() == 1)
216  {
217  consumeMS1Spectrum_(s);
218  }
219  else
220  {
221  if (s.getPrecursors().empty())
222  {
223  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
224  "Swath scan does not provide a precursor.");
225  }
226 
227  const std::vector<Precursor> prec = s.getPrecursors();
228  double center = prec[0].getMZ();
229  double lower = prec[0].getMZ() - prec[0].getIsolationWindowLowerOffset();
230  double upper = prec[0].getMZ() + prec[0].getIsolationWindowUpperOffset();
231  bool found = false;
232 
233  // Check if enough information is present to infer the swath
234  if (center <= 0.0)
235  {
236  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
237  "Swath scan does not provide any precursor isolation information.");
238  }
239 
240  // try to match the current scan to one of the already known windows
241  for (Size i = 0; i < swath_map_boundaries_.size(); i++)
242  {
243  // We group by the precursor mz (center of the window) since this
244  // should be present in all SWATH scans.
245  if (std::fabs(center - swath_map_boundaries_[i].center) < 1e-6)
246  {
247  found = true;
248  consumeSwathSpectrum_(s, i);
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  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 
297  virtual void consumeMS1Spectrum_(MapType::SpectrumType& s) = 0;
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 
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 
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_(NULL),
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_(NULL),
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_ != NULL)
430  {
431  delete ms1_consumer_;
432  ms1_consumer_ = NULL;
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 
451  {
452  while (swath_maps_.size() <= swath_nr)
453  {
454  addNewSwathMap_();
455  }
456  swath_consumers_[swath_nr]->consumeSpectrum(s);
457  swath_maps_[swath_nr]->addSpectrum(s); // append for the metadata (actual data is 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_ == NULL)
473  {
474  addMS1Map_();
475  }
476  ms1_consumer_->consumeSpectrum(s);
477  ms1_map_->addSpectrum(s); // append for the metadata (actual data is deleted)
478  }
479 
481  {
482  size_t swath_consumers_size = swath_consumers_.size();
483  bool have_ms1 = (ms1_consumer_ != NULL);
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_ != NULL)
499  {
500  delete ms1_consumer_;
501  ms1_consumer_ = NULL;
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  CachedmzML().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  CachedmzML().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 
546  class OPENMS_DLLAPI MzMLSwathFileConsumer :
547  public FullSwathFileConsumer
548  {
549 
550 public:
551  typedef PeakMap MapType;
554 
555  MzMLSwathFileConsumer(String cachedir, String basename, Size nr_ms1_spectra, std::vector<int> nr_ms2_spectra) :
556  ms1_consumer_(NULL),
557  swath_consumers_(),
558  cachedir_(cachedir),
559  basename_(basename),
560  nr_ms1_spectra_(nr_ms1_spectra),
561  nr_ms2_spectra_(nr_ms2_spectra)
562  {}
563 
564  MzMLSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries,
565  String cachedir, String basename, Size nr_ms1_spectra, std::vector<int> nr_ms2_spectra) :
566  FullSwathFileConsumer(known_window_boundaries),
567  ms1_consumer_(NULL),
568  swath_consumers_(),
569  cachedir_(cachedir),
570  basename_(basename),
571  nr_ms1_spectra_(nr_ms1_spectra),
572  nr_ms2_spectra_(nr_ms2_spectra)
573  {}
574 
576  {
577  deleteSetNull_();
578  }
579 
580 protected:
581 
583  {
584  // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
585  while (!swath_consumers_.empty())
586  {
587  delete swath_consumers_.back();
588  swath_consumers_.pop_back();
589  }
590  if (ms1_consumer_ != NULL)
591  {
592  delete ms1_consumer_;
593  ms1_consumer_ = NULL;
594  }
595  }
596 
598  {
599  String mzml_file = cachedir_ + basename_ + "_" + String(swath_consumers_.size()) + ".mzML";
600  PlainMSDataWritingConsumer* consumer = new PlainMSDataWritingConsumer(mzml_file);
601  consumer->setExpectedSize(nr_ms2_spectra_[swath_consumers_.size()], 0);
602  swath_consumers_.push_back(consumer);
603  }
604 
606  {
607  // only use swath_maps_ to count how many we have already added
608  while (swath_consumers_.size() <= swath_nr)
609  {
610  addNewSwathMap_();
611  }
612  swath_consumers_[swath_nr]->consumeSpectrum(s);
613  s.clear(false);
614  }
615 
616  void addMS1Map_()
617  {
618  String mzml_file = cachedir_ + basename_ + "_ms1.mzML";
619  ms1_consumer_ = new PlainMSDataWritingConsumer(mzml_file);
620  ms1_consumer_->setExpectedSize(nr_ms1_spectra_, 0);
621  boost::shared_ptr<PeakMap > exp(new PeakMap(settings_));
622  // ms1_map_ = exp;
623  }
624 
626  {
627  if (ms1_consumer_ == NULL)
628  {
629  addMS1Map_();
630  }
631  ms1_consumer_->consumeSpectrum(s);
632  s.clear(false);
633  }
634 
636  {
637  deleteSetNull_();
638  }
639 
641  std::vector<PlainMSDataWritingConsumer*> swath_consumers_;
642 
646  std::vector<int> nr_ms2_spectra_;
647  };
648 
649 }
650 
651 #endif
PlainMSDataWritingConsumer * ms1_consumer_
Definition: SwathFileConsumer.h:640
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
void ensureMapsAreFilled_()
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:380
bool use_external_boundaries_
Whether to use external input for SWATH boundaries.
Definition: SwathFileConsumer.h:321
bool consuming_possible_
Whether further spectra can still be consumed.
Definition: SwathFileConsumer.h:318
std::vector< boost::shared_ptr< PeakMap > > swath_maps_
A list of SWATH maps and the MS1 map.
Definition: SwathFileConsumer.h:310
A more convenient string class.
Definition: String.h:57
void setExperimentalSettings(const ExperimentalSettings &exp)
Set experimental settings (meta-data) of the data to be consumed.
Definition: SwathFileConsumer.h:139
RegularSwathFileConsumer()
Definition: SwathFileConsumer.h:343
RegularSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries)
Definition: SwathFileConsumer.h:345
String basename_
Definition: SwathFileConsumer.h:644
Consumer class that writes MS data to disk using the mzML format.
Definition: MSDataWritingConsumer.h:241
static OpenSwath::SpectrumAccessPtr getSpectrumAccessOpenMSPtr(boost::shared_ptr< OpenMS::PeakMap > exp)
Simple Factory method to get a SpectrumAccess Ptr from an MSExperiment.
The representation of a chromatogram.
Definition: MSChromatogram.h:55
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr)
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:450
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:340
MSDataCachedConsumer * ms1_consumer_
Definition: SwathFileConsumer.h:528
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr)
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:355
On-disk mzML implementation of FullSwathFileConsumer.
Definition: SwathFileConsumer.h:546
void retrieveSwathMaps(std::vector< OpenSwath::SwathMap > &maps)
Populate the vector of swath maps after consuming all spectra.
Definition: SwathFileConsumer.h:152
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:341
int nr_ms1_spectra_
Definition: SwathFileConsumer.h:533
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:135
void consumeSpectrum(MapType::SpectrumType &s)
* Consume a spectrum which may belong either to an MS1 scan or one of n MS2 (SWATH) scans ...
Definition: SwathFileConsumer.h:207
void consumeMS1Spectrum_(MapType::SpectrumType &s)
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:625
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:552
Transforming and cached writing consumer of MS data.
Definition: MSDataCachedConsumer.h:55
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:399
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
FullSwathFileConsumer()
Definition: SwathFileConsumer.h:110
MzMLSwathFileConsumer(String cachedir, String basename, Size nr_ms1_spectra, std::vector< int > nr_ms2_spectra)
Definition: SwathFileConsumer.h:555
void addMS1Map_()
Definition: SwathFileConsumer.h:616
FullSwathFileConsumer(std::vector< OpenSwath::SwathMap > swath_boundaries)
Constructor.
Definition: SwathFileConsumer.h:126
#define LOG_DEBUG
Macro for general debugging information.
Definition: LogStream.h:459
PeakMap MapType
Definition: SwathFileConsumer.h:339
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:553
Abstract base class which can consume spectra coming from SWATH experiment stored in a single file...
Definition: SwathFileConsumer.h:101
PeakMap MapType
Definition: SwathFileConsumer.h:397
std::vector< int > nr_ms2_spectra_
Definition: SwathFileConsumer.h:534
File adapter for MzML files.
Definition: MzMLFile.h:56
PeakMap MapType
Definition: SwathFileConsumer.h:106
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
A method or algorithm argument contains illegal values.
Definition: Exception.h:649
int nr_ms1_spectra_
Definition: SwathFileConsumer.h:645
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...
PeakMap MapType
Definition: SwathFileConsumer.h:551
void consumeChromatogram(MapType::ChromatogramType &)
Consume a chromatogram -> should not happen when dealing with SWATH maps.
Definition: SwathFileConsumer.h:197
MSExperiment PeakMap
Two-dimensional map of raw data points or peaks.
Definition: StandardTypes.h:59
void addNewSwathMap_()
Definition: SwathFileConsumer.h:437
~FullSwathFileConsumer()
Definition: SwathFileConsumer.h:136
PeakMap settings_
The Experimental settings.
Definition: SwathFileConsumer.h:315
On-disk cached implementation of FullSwathFileConsumer.
Definition: SwathFileConsumer.h:392
void deleteSetNull_()
Definition: SwathFileConsumer.h:582
std::vector< OpenSwath::SwathMap > swath_map_boundaries_
A list of Swath map identifiers (lower/upper boundary and center)
Definition: SwathFileConsumer.h:307
String cachedir_
Definition: SwathFileConsumer.h:531
void addNewSwathMap_()
Definition: SwathFileConsumer.h:349
Data structure to hold one SWATH map with information about upper / lower isolation window and whethe...
Definition: SwathMap.h:46
void addMS1Map_()
Definition: SwathFileConsumer.h:365
OpenSwath::SpectrumAccessPtr sptr
Definition: SwathMap.h:48
MapType::ChromatogramType ChromatogramType
Definition: SwathFileConsumer.h:108
void ensureMapsAreFilled_()
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:480
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition: Exception.h:348
In-memory implementation of FullSwathFileConsumer.
Definition: SwathFileConsumer.h:334
void consumeMS1Spectrum_(MapType::SpectrumType &s)
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:470
void clear(bool clear_meta_data)
Clears all data and meta data.
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:398
~CachedSwathFileConsumer()
Definition: SwathFileConsumer.h:421
void addMS1Map_()
Definition: SwathFileConsumer.h:460
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
void addNewSwathMap_()
Definition: SwathFileConsumer.h:597
boost::shared_ptr< PeakMap > ms1_map_
Definition: SwathFileConsumer.h:311
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr)
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition: SwathFileConsumer.h:605
An class that uses on-disk caching to read and write spectra and chromatograms.
Definition: CachedMzML.h:64
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
The interface of a consumer of spectra and chromatograms.
Definition: IMSDataConsumer.h:68
std::vector< int > nr_ms2_spectra_
Definition: SwathFileConsumer.h:646
std::vector< MSDataCachedConsumer * > swath_consumers_
Definition: SwathFileConsumer.h:529
UInt getMSLevel() const
Returns the MS level.
void setExpectedSize(Size, Size)
Set expected size of spectra and chromatograms to be consumed.
Definition: MSDataCachedConsumer.h:121
void ensureMapsAreFilled_()
Callback function after the reading is complete.
Definition: SwathFileConsumer.h:635
void consumeMS1Spectrum_(MapType::SpectrumType &s)
Consume an MS1 spectrum.
Definition: SwathFileConsumer.h:371
double center
Definition: SwathMap.h:51
void writeMetadata(MapType exp, String out_meta, bool addCacheMetaValue=false)
Write only the meta data of an MSExperiment.
String cachedir_
Definition: SwathFileConsumer.h:643
MzMLSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries, String cachedir, String basename, Size nr_ms1_spectra, std::vector< int > nr_ms2_spectra)
Definition: SwathFileConsumer.h:564
String basename_
Definition: SwathFileConsumer.h:532
double upper
Definition: SwathMap.h:50
bool ms1
Definition: SwathMap.h:52
~MzMLSwathFileConsumer()
Definition: SwathFileConsumer.h:575
Description of the experimental settings.
Definition: ExperimentalSettings.h:59
MapType::SpectrumType SpectrumType
Definition: SwathFileConsumer.h:107
size_t correct_window_counter_
How many windows were correctly annotated (non-zero window limits)
Definition: SwathFileConsumer.h:324
void setExpectedSize(Size, Size)
Set expected size of spectra and chromatograms to be consumed.
Definition: SwathFileConsumer.h:138
double lower
Definition: SwathMap.h:49
CachedSwathFileConsumer(String cachedir, String basename, Size nr_ms1_spectra, std::vector< int > nr_ms2_spectra)
Definition: SwathFileConsumer.h:401
std::vector< PlainMSDataWritingConsumer * > swath_consumers_
Definition: SwathFileConsumer.h:641

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:04 using doxygen 1.8.13