OpenMS
FullSwathFileConsumer Class Referenceabstract

Abstract base class which can consume spectra coming from SWATH experiment stored in a single file. More...

#include <OpenMS/FORMAT/DATAACCESS/SwathFileConsumer.h>

Inheritance diagram for FullSwathFileConsumer:
[legend]
Collaboration diagram for FullSwathFileConsumer:
[legend]

Public Types

typedef PeakMap MapType
 
typedef MapType::SpectrumType SpectrumType
 
typedef MapType::ChromatogramType ChromatogramType
 
- Public Types inherited from IMSDataConsumer
typedef MSSpectrum SpectrumType
 
typedef MSChromatogram ChromatogramType
 

Public Member Functions

 FullSwathFileConsumer ()
 
 FullSwathFileConsumer (std::vector< OpenSwath::SwathMap > swath_boundaries)
 Constructor. More...
 
 ~FullSwathFileConsumer () override
 
void setExpectedSize (Size, Size) override
 Set expected size of spectra and chromatograms to be consumed. More...
 
void setExperimentalSettings (const ExperimentalSettings &exp) override
 Set experimental settings (meta-data) of the data to be consumed. More...
 
void retrieveSwathMaps (std::vector< OpenSwath::SwathMap > &maps)
 Populate the vector of swath maps after consuming all spectra. More...
 
void consumeChromatogram (MapType::ChromatogramType &) override
 Consume a chromatogram -> should not happen when dealing with SWATH maps. More...
 
void consumeSpectrum (MapType::SpectrumType &s) override
 
  • Consume a spectrum which may belong either to an MS1 scan or one of n MS2 (SWATH) scans
More...
 
- Public Member Functions inherited from IMSDataConsumer
virtual ~IMSDataConsumer ()
 

Protected Member Functions

virtual void consumeSwathSpectrum_ (MapType::SpectrumType &s, size_t swath_nr)=0
 Consume an MS2 spectrum belonging to SWATH "swath_nr". More...
 
virtual void consumeMS1Spectrum_ (MapType::SpectrumType &s)=0
 Consume an MS1 spectrum. More...
 
virtual void ensureMapsAreFilled_ ()=0
 Callback function after the reading is complete. More...
 

Protected Attributes

std::vector< OpenSwath::SwathMapswath_map_boundaries_
 A list of Swath map identifiers (lower/upper boundary and center) More...
 
std::vector< boost::shared_ptr< PeakMap > > swath_maps_
 A list of SWATH maps and the MS1 map. More...
 
boost::shared_ptr< PeakMapms1_map_
 
PeakMap settings_
 The Experimental settings. More...
 
bool consuming_possible_
 Whether further spectra can still be consumed. More...
 
bool use_external_boundaries_
 Whether to use external input for SWATH boundaries. More...
 
size_t correct_window_counter_
 How many windows were correctly annotated (non-zero window limits) More...
 

Detailed Description

Abstract base class which can consume spectra coming from SWATH experiment stored in a single file.

The class consumes spectra which are coming from a complete SWATH experiment. It will group MS2 spectra by their precursor m/z, assuming that they correspond to the same SWATH window. For example, the spectra could be arranged in the following fashion:

  • MS1 Spectrum (no precursor)
  • MS2 Spectrum (precursor = [400,425])
  • MS2 Spectrum (precursor = [425,450])
  • [...]
  • MS2 Spectrum (precursor = [1175,1200])
  • MS1 Spectrum (no precursor)
  • MS2 Spectrum (precursor = [400,425])
  • MS2 Spectrum (precursor = [425,450])
  • [...]

Base classes are expected to implement functions consuming a spectrum coming from a specific SWATH or an MS1 spectrum and a final function ensureMapsAreFilled_ after which the swath_maps_ vector needs to contain valid pointers to MSExperiment.

In addition it is possible to provide the swath boundaries and the read in spectra will be matched by their precursor m/z to the "center" attribute of the provided Swath maps.

Usage:

FullSwathFileConsumer * dataConsumer;
// assign dataConsumer to an implementation of FullSwathFileConsumer
MzMLFile().transform(file, dataConsumer);
dataConsumer->retrieveSwathMaps(maps);
FullSwathFileConsumer()
Definition: SwathFileConsumer.h:84

Member Typedef Documentation

◆ ChromatogramType

◆ MapType

typedef PeakMap MapType

◆ SpectrumType

Constructor & Destructor Documentation

◆ FullSwathFileConsumer() [1/2]

◆ FullSwathFileConsumer() [2/2]

FullSwathFileConsumer ( std::vector< OpenSwath::SwathMap swath_boundaries)
inline

Constructor.

Parameters
swath_boundariesA vector of SwathMaps of which only the center, lower and upper attributes will be used to infer the expected Swath maps.

◆ ~FullSwathFileConsumer()

~FullSwathFileConsumer ( )
inlineoverride

Member Function Documentation

◆ consumeChromatogram()

void consumeChromatogram ( MapType::ChromatogramType )
inlineoverridevirtual

Consume a chromatogram -> should not happen when dealing with SWATH maps.

Implements IMSDataConsumer.

◆ consumeMS1Spectrum_()

virtual void consumeMS1Spectrum_ ( MapType::SpectrumType s)
protectedpure virtual

Consume an MS1 spectrum.

This function should handle an MS1 spectrum.

Implemented in MzMLSwathFileConsumer, CachedSwathFileConsumer, and RegularSwathFileConsumer.

◆ consumeSpectrum()

void consumeSpectrum ( MapType::SpectrumType s)
inlineoverridevirtual

◆ consumeSwathSpectrum_()

virtual void consumeSwathSpectrum_ ( MapType::SpectrumType s,
size_t  swath_nr 
)
protectedpure virtual

Consume an MS2 spectrum belonging to SWATH "swath_nr".

This function should handle a spectrum belonging to a specific SWATH (indicated by swath_nr).

Implemented in MzMLSwathFileConsumer, CachedSwathFileConsumer, and RegularSwathFileConsumer.

◆ ensureMapsAreFilled_()

virtual void ensureMapsAreFilled_ ( )
protectedpure virtual

Callback function after the reading is complete.

Has to ensure that swath_maps_ and ms1_map_ are correctly populated.

Implemented in MzMLSwathFileConsumer, CachedSwathFileConsumer, and RegularSwathFileConsumer.

◆ retrieveSwathMaps()

void retrieveSwathMaps ( std::vector< OpenSwath::SwathMap > &  maps)
inline

Populate the vector of swath maps after consuming all spectra.

Will populate the input vector with SwathMap objects which correspond to the MS1 map (if present) and the MS2 maps (SWATH maps). This should be called after all spectra are consumed.

Note
It is not possible to consume any more spectra after calling this function (it contains finalization code and may close file streams).

References SwathMap::center, SimpleOpenMSSpectraFactory::getSpectrumAccessOpenMSPtr(), SwathMap::imLower, SwathMap::imUpper, SwathMap::lower, SwathMap::ms1, SwathMap::sptr, and SwathMap::upper.

◆ setExpectedSize()

void setExpectedSize ( Size  expectedSpectra,
Size  expectedChromatograms 
)
inlineoverridevirtual

Set expected size of spectra and chromatograms to be consumed.

Some implementations might care about the number of spectra and chromatograms to be consumed and need to be informed about this (usually before consuming starts).

Note
Calling this method is optional but good practice.
Parameters
expectedSpectraNumber of spectra expected
expectedChromatogramsNumber of chromatograms expected

Implements IMSDataConsumer.

◆ setExperimentalSettings()

void setExperimentalSettings ( const ExperimentalSettings exp)
inlineoverridevirtual

Set experimental settings (meta-data) of the data to be consumed.

Some implementations might need to know about the meta-data (or the context) of the spectra and chromatograms to be consumed. This method allows them learn this.

Note
Calling this method is optional but good practice.
Parameters
expExperimental settings meta data for the data to be consumed

Implements IMSDataConsumer.

Member Data Documentation

◆ consuming_possible_

bool consuming_possible_
protected

Whether further spectra can still be consumed.

◆ correct_window_counter_

size_t correct_window_counter_
protected

How many windows were correctly annotated (non-zero window limits)

◆ ms1_map_

boost::shared_ptr<PeakMap > ms1_map_
protected

◆ settings_

PeakMap settings_
protected

The Experimental settings.

◆ swath_map_boundaries_

std::vector<OpenSwath::SwathMap> swath_map_boundaries_
protected

A list of Swath map identifiers (lower/upper boundary and center)

◆ swath_maps_

std::vector<boost::shared_ptr<PeakMap > > swath_maps_
protected

A list of SWATH maps and the MS1 map.

◆ use_external_boundaries_

bool use_external_boundaries_
protected

Whether to use external input for SWATH boundaries.