| OpenMS 2.5.0

Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Private Attributes | List of all members
SwathQC Class Reference

Quality Control function for OpenSwath. More...

`#include <OpenMS/ANALYSIS/OPENSWATH/SwathQC.h>`

## Public Types

typedef std::map< int, int > | ChargeDistribution

## Public Member Functions

| SwathQC ()=delete
| default C'tor (forbidden) More...
| SwathQC (const size_t cd_spectra, const double decon_ms1_mz_tol)
| CTor with arguments. More...
std::function< void(const OpenMS::ExperimentalSettings &es)> | getExpSettingsFunc ()
| Returns a lambda function, which captures internal members and can be used in MSDataTransformingConsumer::setExperimentalSettingsFunc() More...
std::function< void(const OpenMS::MSSpectrum &)> | getSpectraProcessingFunc ()
void | storeJSON (const OpenMS::String &filename)
| Save all internally collected data to a JSON file. More...
const ChargeDistribution & | getChargeDistribution () const
| returns the charge distribution which was internally computed by applying getSpectraProcessingFunc() externally More...
void | setNrMS1Spectra (size_t nr)
| Explicitly set the number of expected MS1 spectra (for sampling charge distribution) More...

## Static Public Member Functions

static ChargeDistribution | getChargeDistribution (const std::vector< SwathMap > &swath_maps, const size_t nr_samples, const double mz_tol)
| Sample the spectra in all MS1 Swath maps and determine all charge states. More...

## Static Protected Member Functions

static bool | isSubsampledSpectrum_ (const size_t total_spec_count, const size_t subsample_count, const size_t idx)
| Given a total spectrum count and a number of spectra to inspect, is the current index a candidate? More...

## Private Attributes

ChargeDistribution | cd_
| internal ChargeDistribution which is augmented upon calling the corresponding member functions More...
size_t | nr_ms1_spectra_
| number of MS1 spectra expected More...
size_t | cd_spectra_
| number of spectra to inspect for charge distribution More...
double | decon_ms1_mz_tol_
| m/z tolerance for isotope deconvolution More...
size_t | ms1_spectra_seen_
| keeps track of number of spectra passed to getSpectraProcessingFunc() More...

## Detailed Description

Quality Control function for OpenSwath.

The class is meant to collect information as a plugin of type IMSDataConsumer. You can (if the relevant data is already available and you do not mind the overhead), call static functions, which will do the same.

## Member Typedef Documentation

## ◆ ChargeDistribution

typedef std::map<int,int> ChargeDistribution

## Constructor & Destructor Documentation

## ◆ SwathQC() [1/2]

SwathQC | ( |  | ) |

delete

default C'tor (forbidden)

## ◆ SwathQC() [2/2]

SwathQC | ( | const size_t | cd_spectra,
|  | const double | decon_ms1_mz_tol
| ) |  |

CTor with arguments.

Parameters

  cd_spectra | Number of MS spectra to inspect for charge distribution estimation
  decon_ms1_mz_tol | m/z tolerance for isotope deconvolution

## Member Function Documentation

## ◆ getChargeDistribution() [1/2]

static ChargeDistribution getChargeDistribution | ( | const std::vector< SwathMap > & | swath_maps,
|  | const size_t | nr_samples,
|  | const double | mz_tol
| ) |  |

static

Sample the spectra in all MS1 Swath maps and determine all charge states.

Conveniently wraps internal functions and applies them to a whole set of data. However, it might be more speed efficient to sample the spectra as they are loaded using member functions.

From all swath maps in `swath_maps` which are ms_level == 1 we extract `nr_samples` spectra (subsampling), determine the charge states of all isotopic envelopes and return their total counts using getSpectraProcessingFunc().

Parameters

  [in] | swath_maps | Swath maps of mixed ms-level
  [in] | nr_samples | Number of spectra to sample per Swath map. To sample all spectra, set to -1
  [in] | mz_tol | Error tolerance in Th in which an isotopic peak is expected (assuming C12-C13 distance)

Returns
  Distribution of charge (key = charge, value = counts)

Exceptions

  Exception::Postcondition | if Deisotoper did not return charge data

## ◆ getChargeDistribution() [2/2]

const ChargeDistribution& getChargeDistribution | ( |  | ) | const

returns the charge distribution which was internally computed by applying getSpectraProcessingFunc() externally

## ◆ getExpSettingsFunc()

std::function<void(const OpenMS::ExperimentalSettings& es)> getExpSettingsFunc | ( |  | ) |

Returns a lambda function, which captures internal members and can be used in MSDataTransformingConsumer::setExperimentalSettingsFunc()

If `es` contains a metavalue 'nr_ms1_spectra' it will be used to set the internal number of expected MS1 spectra

## ◆ getSpectraProcessingFunc()

std::function<void (const OpenMS::MSSpectrum&)> getSpectraProcessingFunc | ( |  | ) |

returns a lambda function, which captures internal members and can be used in MSDataTransformingConsumer::setExperimentalSettingsFunc() PeakPicking is performed internally if the data is estimated to be profile data. Uses the Deisotoper class for charge determination and updates the internal charge count.

## ◆ isSubsampledSpectrum_()

static bool isSubsampledSpectrum_ | ( | const size_t | total_spec_count,
|  | const size_t | subsample_count,
|  | const size_t | idx
| ) |  |

static protected

Given a total spectrum count and a number of spectra to inspect, is the current index a candidate?

Allows to uniformly sample a range of spectra. E.g. given 10 spectra exist, and we want to subsample 4 of them, the answer of this function for every requested index from 0..9 is:

If the total number of spectra is unknown, pass 0 as first argument, which will return true for every query, i.e. sample everything.

Parameters

  [in] | total_spec_count | Total number of spectra expected
  [in] | subsample_count | Number of spectra which should be sampled from `total_spec_count`
  [in] | idx | Index of the spectrum under question

## ◆ setNrMS1Spectra()

void setNrMS1Spectra | ( | size_t | nr | ) |

Explicitly set the number of expected MS1 spectra (for sampling charge distribution)

Computing the charge distribution using getSpectraProcessingFunc() requires knowing the total number of MS1 spectra. Either use getExpSettingsFunc() externally, or use this method to set it explicitly (depending on workflow). If `nr` is set to 0, all spectra passed into getSpectraProcessingFunc() will be inspected for their charge distribution.

## ◆ storeJSON()

void storeJSON | ( | const OpenMS::String & | filename | ) |

Save all internally collected data to a JSON file.

## Member Data Documentation

## ◆ cd_

ChargeDistribution cd_

private

internal ChargeDistribution which is augmented upon calling the corresponding member functions

## ◆ cd_spectra_

size_t cd_spectra_

private

number of spectra to inspect for charge distribution

## ◆ decon_ms1_mz_tol_

double decon_ms1_mz_tol_

private

m/z tolerance for isotope deconvolution

## ◆ ms1_spectra_seen_

size_t ms1_spectra_seen_

private

keeps track of number of spectra passed to getSpectraProcessingFunc()

## ◆ nr_ms1_spectra_

size_t nr_ms1_spectra_

private

number of MS1 spectra expected