OpenMS
Loading...
Searching...
No Matches
SwathFileConsumer.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- 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
15
16// Consumers
21
22
23// Helpers
27
31
32#include <exception>
33#include <vector>
34
35#ifdef _OPENMP
36#include <omp.h>
37#endif
38
39namespace OpenMS
40{
41
79 class OPENMS_DLLAPI FullSwathFileConsumer :
81 {
82
83public:
87
89 ms1_map_(), // initialize to null
90 consuming_possible_(true),
91 use_external_boundaries_(false),
92 correct_window_counter_(0)
93 {
94 use_external_boundaries_ = !swath_map_boundaries_.empty();
95 }
96
104 FullSwathFileConsumer(std::vector<OpenSwath::SwathMap> swath_boundaries) :
105 swath_map_boundaries_(swath_boundaries),
106 ms1_map_(), // initialize to null
107 consuming_possible_(true),
108 use_external_boundaries_(false),
109 correct_window_counter_(0)
110 {
111 use_external_boundaries_ = !swath_map_boundaries_.empty();
112 }
113
115
116 void setExpectedSize(Size, Size) override {}
117 void setExperimentalSettings(const ExperimentalSettings& exp) override {settings_ = exp; }
118
130 void retrieveSwathMaps(std::vector<OpenSwath::SwathMap>& maps)
131 {
132 consuming_possible_ = false; // make consumption of further spectra / chromatograms impossible
133 ensureMapsAreFilled_();
134 if (ms1_map_)
135 {
137 map.sptr = SimpleOpenMSSpectraFactory::getSpectrumAccessOpenMSPtr(ms1_map_);
138 map.lower = -1;
139 map.upper = -1;
140 map.center = -1;
141 map.imLower = -1;
142 map.imUpper = -1;
143 map.ms1 = true;
144 maps.push_back(map);
145 }
146
147 // Print warning if the lower/upper window could not be determined and we
148 // required manual determination of the boundaries.
149 if (!use_external_boundaries_ && correct_window_counter_ != swath_maps_.size())
150 {
151 std::cout << "WARNING: Could not correctly read the upper/lower limits of the SWATH windows from your input file. Read " <<
152 correct_window_counter_ << " correct (non-zero) window limits (expected " << swath_maps_.size() << " windows)." << std::endl;
153 }
154
155 // Creating the access object of a map that was cached to disk means building the index of
156 // its data file and parsing its meta data file. The maps are independent of each other, so
157 // do that for all of them at once: one after the other it took 38 s for the 300 windows of
158 // an Orbitrap Astral run.
159 std::vector<OpenSwath::SpectrumAccessPtr> map_access(swath_maps_.size());
160 std::exception_ptr access_error;
161#ifdef _OPENMP
162#pragma omp parallel for
163#endif
164 for (SignedSize i = 0; i < static_cast<SignedSize>(swath_maps_.size()); i++)
165 {
166 try
167 {
168 map_access[i] = SimpleOpenMSSpectraFactory::getSpectrumAccessOpenMSPtr(swath_maps_[i]);
169 }
170 catch (...)
171 {
172#ifdef _OPENMP
173#pragma omp critical (FullSwathFileConsumer_retrieveSwathMaps)
174#endif
175 {
176 if (!access_error) access_error = std::current_exception();
177 }
178 }
179 }
180 if (access_error)
181 {
182 std::rethrow_exception(access_error);
183 }
184
185 size_t nonempty_maps = 0;
186 for (Size i = 0; i < swath_maps_.size(); i++)
187 {
189 map.sptr = map_access[i];
190 map.lower = swath_map_boundaries_[i].lower;
191 map.upper = swath_map_boundaries_[i].upper;
192 map.center = swath_map_boundaries_[i].center;
193 map.imLower = swath_map_boundaries_[i].imLower;
194 map.imUpper = swath_map_boundaries_[i].imUpper;
195 map.ms1 = false;
196 maps.push_back(map);
197 if (map.sptr->getNrSpectra() > 0) {nonempty_maps++;}
198 }
199
200 if (nonempty_maps != swath_map_boundaries_.size())
201 {
202 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 (" <<
203 swath_map_boundaries_.size() << "). Please check your input." << std::endl;
204 }
205
206 }
207
210 {
211 std::cerr << "Read chromatogram while reading SWATH files, did not expect that!" << std::endl;
212 }
213
220 {
221
222 if (!consuming_possible_)
223 {
224 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
225 "FullSwathFileConsumer cannot consume any more spectra after retrieveSwathMaps has been called already");
226 }
227
228 if (s.getMSLevel() == 1)
229 {
230 consumeMS1Spectrum_(s);
231 }
232 else
233 {
234 if (s.getPrecursors().empty())
235 {
236 throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
237 "Swath scan does not provide a precursor.");
238 }
239
240 const std::vector<Precursor>& prec = s.getPrecursors();
241 double center = prec[0].getMZ();
242 double lower = prec[0].getMZ() - prec[0].getIsolationWindowLowerOffset();
243 double upper = prec[0].getMZ() + prec[0].getIsolationWindowUpperOffset();
244
245 double lowerIm = -1; // these initial values assume IM is not present
246 double upperIm = -1;
247
248 // add IM if present
249 if (s.metaValueExists("ion mobility lower limit"))
250 {
251 lowerIm = (double)s.getMetaValue("ion mobility lower limit"); // want this to be -1 if no ion mobility
252 upperIm = (double)s.getMetaValue("ion mobility upper limit");
253 }
254
255 bool found = false;
256
257 // Check if enough information is present to infer the swath
258 if (center <= 0.0)
259 {
260 throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
261 "Swath scan does not provide any precursor isolation information.");
262 }
263
264 // try to match the current scan to one of the already known windows
265 for (Size i = 0; i < swath_map_boundaries_.size(); i++)
266 {
267 // We group by the precursor mz (center of the window) since this
268 // should be present in all SWATH scans.
269 // also specify ion mobility, if ion mobility not present will just be -1
270 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))
271 {
272 found = true;
273 consumeSwathSpectrum_(s, i);
274 break;
275 }
276 }
277 if (!found)
278 {
279 if (use_external_boundaries_)
280 {
281 throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
282 std::string("Encountered SWATH scan with boundary ") + center + " m/z which was not present in the provided windows.");
283 }
284 else
285 {
286 consumeSwathSpectrum_(s, swath_map_boundaries_.size());
287
288 // we found a new SWATH window
289 if (lower > 0.0 && upper > 0.0)
290 {correct_window_counter_++;}
291
292 OpenSwath::SwathMap boundary;
293 boundary.lower = lower;
294 boundary.upper = upper;
295 boundary.center = center;
296 boundary.imLower = lowerIm;
297 boundary.imUpper = upperIm;
298 swath_map_boundaries_.push_back(boundary);
299
300 OPENMS_LOG_DEBUG << "Adding Swath centered at " << center
301 << " m/z with an isolation window of " << lower << " to " << upper
302 << " m/z and IM lower limit of " << lowerIm << " and upper limit of " << upperIm << std::endl;
303 }
304 }
305 }
306 }
307
308protected:
309
317 virtual void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) = 0;
318
326
332 virtual void ensureMapsAreFilled_() = 0;
333
335 std::vector<OpenSwath::SwathMap> swath_map_boundaries_;
336
338 std::vector<std::shared_ptr<PeakMap > > swath_maps_;
339 std::shared_ptr<PeakMap > ms1_map_;
340
342 // (MSExperiment has no constructor using ExperimentalSettings)
344
347
350
353
354 };
355
362 class OPENMS_DLLAPI RegularSwathFileConsumer :
364 {
365
366public:
370
372
373 RegularSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries) :
374 FullSwathFileConsumer(known_window_boundaries) {}
375
376protected:
378 {
379 std::shared_ptr<PeakMap > exp(new PeakMap(settings_));
380 swath_maps_.push_back(exp);
381 }
382
383 void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
384 {
385 while (swath_maps_.size() <= swath_nr)
386 {
387 addNewSwathMap_();
388 }
389
390 swath_maps_[swath_nr]->addSpectrum(s);
391 }
392
394 {
395 std::shared_ptr<PeakMap > exp(new PeakMap(settings_));
396 ms1_map_ = exp;
397 }
398
400 {
401 if (!ms1_map_)
402 {
403 addMS1Map_();
404 }
405 ms1_map_->addSpectrum(s);
406 }
407
408 void ensureMapsAreFilled_() override {}
409 };
410
420 class OPENMS_DLLAPI CachedSwathFileConsumer :
422 {
423
424public:
428
429 CachedSwathFileConsumer(std::string cachedir, std::string basename, Size nr_ms1_spectra, std::vector<int> nr_ms2_spectra) :
430 ms1_consumer_(nullptr),
431 swath_consumers_(),
432 cachedir_(cachedir),
433 basename_(basename),
434 nr_ms1_spectra_(nr_ms1_spectra),
435 nr_ms2_spectra_(nr_ms2_spectra)
436 {}
437
438 CachedSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries,
439 std::string cachedir, std::string basename, Size nr_ms1_spectra, std::vector<int> nr_ms2_spectra) :
440 FullSwathFileConsumer(known_window_boundaries),
441 ms1_consumer_(nullptr),
442 swath_consumers_(),
443 cachedir_(cachedir),
444 basename_(basename),
445 nr_ms1_spectra_(nr_ms1_spectra),
446 nr_ms2_spectra_(nr_ms2_spectra)
447 {}
448
450 {
451 // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
452 while (!swath_consumers_.empty())
453 {
454 delete swath_consumers_.back();
455 swath_consumers_.pop_back();
456 }
457 if (ms1_consumer_ != nullptr)
458 {
459 delete ms1_consumer_;
460 ms1_consumer_ = nullptr;
461 }
462 }
463
464protected:
466 {
467 std::string meta_file = cachedir_ + basename_ + "_" + StringUtils::toStr(swath_consumers_.size()) + ".mzML";
468 std::string cached_file = meta_file + ".cached";
469 MSDataCachedConsumer* consumer = new MSDataCachedConsumer(cached_file, true);
470 consumer->setExpectedSize(nr_ms2_spectra_[swath_consumers_.size()], 0);
471 swath_consumers_.push_back(consumer);
472
473 // maps for meta data
474 std::shared_ptr<PeakMap > exp(new PeakMap(settings_));
475 swath_maps_.push_back(exp);
476 }
477
478 void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
479 {
480 while (swath_maps_.size() <= swath_nr)
481 {
482 addNewSwathMap_();
483 }
484 swath_consumers_[swath_nr]->consumeSpectrum(s); // write data to cached file; clear data from spectrum s
485 swath_maps_[swath_nr]->addSpectrum(s); // append for the metadata (actual data was deleted)
486 }
487
489 {
490 std::string meta_file = cachedir_ + basename_ + "_ms1.mzML";
491 std::string cached_file = meta_file + ".cached";
492 ms1_consumer_ = new MSDataCachedConsumer(cached_file, true);
493 ms1_consumer_->setExpectedSize(nr_ms1_spectra_, 0);
494 std::shared_ptr<PeakMap > exp(new PeakMap(settings_));
495 ms1_map_ = exp;
496 }
497
499 {
500 if (ms1_consumer_ == nullptr)
501 {
502 addMS1Map_();
503 }
504 ms1_consumer_->consumeSpectrum(s);
505 ms1_map_->addSpectrum(s); // append for the metadata (actual data is deleted)
506 }
507
508 void ensureMapsAreFilled_() override
509 {
510 size_t swath_consumers_size = swath_consumers_.size();
511 bool have_ms1 = (ms1_consumer_ != nullptr);
512
513 // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
514 // The file streams to the cached data on disc can and should be closed
515 // here safely. Since ensureMapsAreFilled_ is called after consuming all
516 // the spectra, there will be no more spectra to append but the client
517 // might already want to read after this call, so all data needs to be
518 // present on disc and the file streams closed.
519 //
520 // TODO merge with destructor code into own function!
521 while (!swath_consumers_.empty())
522 {
523 delete swath_consumers_.back();
524 swath_consumers_.pop_back();
525 }
526 if (ms1_consumer_ != nullptr)
527 {
528 delete ms1_consumer_;
529 ms1_consumer_ = nullptr;
530 }
531
532 if (have_ms1)
533 {
534 std::shared_ptr<PeakMap > exp(new PeakMap);
535 std::string meta_file = cachedir_ + basename_ + "_ms1.mzML";
536 // write metadata to disk and store the correct data processing tag
537 Internal::CachedMzMLHandler().writeMetadata(*ms1_map_, meta_file, true);
538 FileHandler().loadExperiment(meta_file, *exp.get(), {FileTypes::MZML});
539 ms1_map_ = exp;
540 }
541
542#ifdef _OPENMP
543#pragma omp parallel for
544#endif
545 for (SignedSize i = 0; i < OpenMS::checkedCast<SignedSize>(swath_consumers_size); i++)
546 {
547 std::shared_ptr<PeakMap > exp(new PeakMap);
548 std::string meta_file = cachedir_ + basename_ + "_" + StringUtils::toStr(i) + ".mzML";
549 // write metadata to disk and store the correct data processing tag
550 Internal::CachedMzMLHandler().writeMetadata(*swath_maps_[i], meta_file, true);
551 FileHandler().loadExperiment(meta_file, *exp.get(), {FileTypes::MZML});
552 swath_maps_[i] = exp;
553 }
554 }
555
557 std::vector<MSDataCachedConsumer*> swath_consumers_;
558
559 std::string cachedir_;
560 std::string basename_;
562 std::vector<int> nr_ms2_spectra_;
563 };
564
577 class OPENMS_DLLAPI MzMLSwathFileConsumer :
579 {
580
581public:
585
586 MzMLSwathFileConsumer(const std::string& cachedir, const std::string& basename, Size nr_ms1_spectra, const std::vector<int>& nr_ms2_spectra) :
587 ms1_consumer_(nullptr),
588 swath_consumers_(),
589 cachedir_(cachedir),
590 basename_(basename),
591 nr_ms1_spectra_(nr_ms1_spectra),
592 nr_ms2_spectra_(nr_ms2_spectra)
593 {}
594
595 MzMLSwathFileConsumer(std::vector<OpenSwath::SwathMap> known_window_boundaries,
596 const std::string& cachedir, const std::string& basename, Size nr_ms1_spectra, const std::vector<int>& nr_ms2_spectra) :
597 FullSwathFileConsumer(known_window_boundaries),
598 ms1_consumer_(nullptr),
599 swath_consumers_(),
600 cachedir_(cachedir),
601 basename_(basename),
602 nr_ms1_spectra_(nr_ms1_spectra),
603 nr_ms2_spectra_(nr_ms2_spectra)
604 {}
605
607 {
608 deleteSetNull_();
609 }
610
611protected:
612
614 {
615 // Properly delete the MSDataCachedConsumer -> free memory and _close_ file stream
616 while (!swath_consumers_.empty())
617 {
618 delete swath_consumers_.back();
619 swath_consumers_.pop_back();
620 }
621 if (ms1_consumer_ != nullptr)
622 {
623 delete ms1_consumer_;
624 ms1_consumer_ = nullptr;
625 }
626 }
627
629 {
630 std::string mzml_file = cachedir_ + basename_ + "_" + StringUtils::toStr(swath_consumers_.size()) + ".mzML";
632 consumer->getOptions().setCompression(true);
633 consumer->setExpectedSize(nr_ms2_spectra_[swath_consumers_.size()], 0);
634 swath_consumers_.push_back(consumer);
635 }
636
637 void consumeSwathSpectrum_(MapType::SpectrumType& s, size_t swath_nr) override
638 {
639 // only use swath_consumers_ to count how many we have already added
640 while (swath_consumers_.size() <= swath_nr)
641 {
642 addNewSwathMap_();
643 }
644 swath_consumers_[swath_nr]->consumeSpectrum(s);
645 s.clear(false);
646 }
647
649 {
650 std::string mzml_file = cachedir_ + basename_ + "_ms1.mzML";
651 ms1_consumer_ = new PlainMSDataWritingConsumer(mzml_file);
652 ms1_consumer_->setExpectedSize(nr_ms1_spectra_, 0);
653 ms1_consumer_->getOptions().setCompression(true);
654 }
655
657 {
658 if (ms1_consumer_ == nullptr)
659 {
660 addMS1Map_();
661 }
662 ms1_consumer_->consumeSpectrum(s);
663 }
664
665 void ensureMapsAreFilled_() override
666 {
667 deleteSetNull_();
668 }
669
671 std::vector<PlainMSDataWritingConsumer*> swath_consumers_;
672
673 std::string cachedir_;
674 std::string basename_;
676 std::vector<int> nr_ms2_spectra_;
677 };
678
679}
680
#define OPENMS_LOG_DEBUG
Definition LogStream.h:714
On-disk cached implementation of FullSwathFileConsumer.
Definition SwathFileConsumer.h:422
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition SwathFileConsumer.h:498
std::vector< MSDataCachedConsumer * > swath_consumers_
Definition SwathFileConsumer.h:557
CachedSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries, std::string cachedir, std::string basename, Size nr_ms1_spectra, std::vector< int > nr_ms2_spectra)
Definition SwathFileConsumer.h:438
void addMS1Map_()
Definition SwathFileConsumer.h:488
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition SwathFileConsumer.h:508
CachedSwathFileConsumer(std::string cachedir, std::string basename, Size nr_ms1_spectra, std::vector< int > nr_ms2_spectra)
Definition SwathFileConsumer.h:429
MapType::ChromatogramType ChromatogramType
Definition SwathFileConsumer.h:427
std::string cachedir_
Definition SwathFileConsumer.h:559
std::string basename_
Definition SwathFileConsumer.h:560
std::vector< int > nr_ms2_spectra_
Definition SwathFileConsumer.h:562
~CachedSwathFileConsumer() override
Definition SwathFileConsumer.h:449
MSDataCachedConsumer * ms1_consumer_
Definition SwathFileConsumer.h:556
PeakMap MapType
Definition SwathFileConsumer.h:425
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition SwathFileConsumer.h:478
MapType::SpectrumType SpectrumType
Definition SwathFileConsumer.h:426
void addNewSwathMap_()
Definition SwathFileConsumer.h:465
int nr_ms1_spectra_
Definition SwathFileConsumer.h:561
A method or algorithm argument contains illegal values.
Definition Exception.h:633
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition Exception.h:317
Description of the experimental settings.
Definition ExperimentalSettings.h:37
Facilitates file handling by file type recognition.
Definition FileHandler.h:52
void loadExperiment(const std::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:81
size_t correct_window_counter_
How many windows were correctly annotated (non-zero window limits)
Definition SwathFileConsumer.h:352
std::vector< std::shared_ptr< PeakMap > > swath_maps_
A list of SWATH maps and the MS1 map.
Definition SwathFileConsumer.h:338
FullSwathFileConsumer(std::vector< OpenSwath::SwathMap > swath_boundaries)
Constructor.
Definition SwathFileConsumer.h:104
~FullSwathFileConsumer() override
Definition SwathFileConsumer.h:114
bool consuming_possible_
Whether further spectra can still be consumed.
Definition SwathFileConsumer.h:346
std::shared_ptr< PeakMap > ms1_map_
Definition SwathFileConsumer.h:339
FullSwathFileConsumer()
Definition SwathFileConsumer.h:88
MapType::ChromatogramType ChromatogramType
Definition SwathFileConsumer.h:86
PeakMap settings_
The Experimental settings.
Definition SwathFileConsumer.h:343
void setExpectedSize(Size, Size) override
Set expected size of spectra and chromatograms to be consumed.
Definition SwathFileConsumer.h:116
virtual void consumeMS1Spectrum_(MapType::SpectrumType &s)=0
Consume an MS1 spectrum.
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:84
void consumeChromatogram(MapType::ChromatogramType &) override
Consume a chromatogram -> should not happen when dealing with SWATH maps.
Definition SwathFileConsumer.h:209
std::vector< OpenSwath::SwathMap > swath_map_boundaries_
A list of Swath map identifiers (lower/upper boundary and center)
Definition SwathFileConsumer.h:335
void retrieveSwathMaps(std::vector< OpenSwath::SwathMap > &maps)
Populate the vector of swath maps after consuming all spectra.
Definition SwathFileConsumer.h:130
void setExperimentalSettings(const ExperimentalSettings &exp) override
Set experimental settings (meta-data) of the data to be consumed.
Definition SwathFileConsumer.h:117
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:219
bool use_external_boundaries_
Whether to use external input for SWATH boundaries.
Definition SwathFileConsumer.h:349
MapType::SpectrumType SpectrumType
Definition SwathFileConsumer.h:85
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 std::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:33
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:49
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.
const DataValue & getMetaValue(const std::string &name) const
Returns the value corresponding to a string, or DataValue::EMPTY if not found.
bool metaValueExists(const std::string &name) const
Returns whether an entry with the given name exists.
On-disk mzML implementation of FullSwathFileConsumer.
Definition SwathFileConsumer.h:579
std::vector< PlainMSDataWritingConsumer * > swath_consumers_
Definition SwathFileConsumer.h:671
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition SwathFileConsumer.h:656
PlainMSDataWritingConsumer * ms1_consumer_
Definition SwathFileConsumer.h:670
void addMS1Map_()
Definition SwathFileConsumer.h:648
~MzMLSwathFileConsumer() override
Definition SwathFileConsumer.h:606
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition SwathFileConsumer.h:665
MzMLSwathFileConsumer(const std::string &cachedir, const std::string &basename, Size nr_ms1_spectra, const std::vector< int > &nr_ms2_spectra)
Definition SwathFileConsumer.h:586
MapType::ChromatogramType ChromatogramType
Definition SwathFileConsumer.h:584
MzMLSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries, const std::string &cachedir, const std::string &basename, Size nr_ms1_spectra, const std::vector< int > &nr_ms2_spectra)
Definition SwathFileConsumer.h:595
std::string cachedir_
Definition SwathFileConsumer.h:673
std::string basename_
Definition SwathFileConsumer.h:674
std::vector< int > nr_ms2_spectra_
Definition SwathFileConsumer.h:676
PeakMap MapType
Definition SwathFileConsumer.h:582
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition SwathFileConsumer.h:637
MapType::SpectrumType SpectrumType
Definition SwathFileConsumer.h:583
void addNewSwathMap_()
Definition SwathFileConsumer.h:628
int nr_ms1_spectra_
Definition SwathFileConsumer.h:675
void deleteSetNull_()
Definition SwathFileConsumer.h:613
void setCompression(bool compress)
Consumer class that writes MS data to disk using the mzML format.
Definition MSDataWritingConsumer.h:237
In-memory implementation of FullSwathFileConsumer.
Definition SwathFileConsumer.h:364
void consumeMS1Spectrum_(MapType::SpectrumType &s) override
Consume an MS1 spectrum.
Definition SwathFileConsumer.h:399
RegularSwathFileConsumer()
Definition SwathFileConsumer.h:371
void addMS1Map_()
Definition SwathFileConsumer.h:393
void ensureMapsAreFilled_() override
Callback function after the reading is complete.
Definition SwathFileConsumer.h:408
MapType::ChromatogramType ChromatogramType
Definition SwathFileConsumer.h:369
PeakMap MapType
Definition SwathFileConsumer.h:367
void consumeSwathSpectrum_(MapType::SpectrumType &s, size_t swath_nr) override
Consume an MS2 spectrum belonging to SWATH "swath_nr".
Definition SwathFileConsumer.h:383
MapType::SpectrumType SpectrumType
Definition SwathFileConsumer.h:368
void addNewSwathMap_()
Definition SwathFileConsumer.h:377
RegularSwathFileConsumer(std::vector< OpenSwath::SwathMap > known_window_boundaries)
Definition SwathFileConsumer.h:373
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
if none is found
Definition common-cmake-parameters.doxygen:76
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
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