OpenMS
PrecursorPurity Class Reference

Precursor purity or noise estimation. More...

#include <OpenMS/ANALYSIS/ID/PrecursorPurity.h>

Classes

struct  PurityScores
 

Static Public Member Functions

static std::map< String, PurityScorescomputePrecursorPurities (const PeakMap &spectra, double precursor_mass_tolerance, bool precursor_mass_tolerance_unit_ppm, bool ignore_missing_precursor_spectra=false)
 compute precursor purity metrics for each MS2 spectrum in a PeakMap This is the main function of this class. See class description. Note: Spectra annotated with charge 0 will be treated as charge 1.
More...
 
static PurityScores computePrecursorPurity (const PeakSpectrum &ms1, const Precursor &pre, const double precursor_mass_tolerance, const bool precursor_mass_tolerance_unit_ppm)
 compute precursor purity metrics for one MS2 precursor More...
 
static std::vector< double > computeSingleScanPrecursorPurities (int ms2_spec_idx, int precursor_spec_idx, const MSExperiment &exp, double max_precursor_isotope_deviation)
 Computes a simple purity score aggregate for all Precursors (and their windows) of spectrum at ms2_spec_idx in the precursor spectrum at precursor_spec_idx. More...
 
static std::vector< double > computeInterpolatedPrecursorPurity (int ms2_spec_idx, int precursor_spec_idx, int next_ms1_spec_idx, const MSExperiment &exp, double max_precursor_isotope_deviation)
 Computes a simple purity score aggregate for all Precursors (and their windows) of spectrum at ms2_spec_idx interpolated between precursor spectrum at precursor_spec_idx and the next parent type spectrum at next_ms1_spec_idx. More...
 

Static Private Member Functions

static PurityScores combinePrecursorPurities (const PrecursorPurity::PurityScores &score1, const PrecursorPurity::PurityScores &score2)
 

Detailed Description

Precursor purity or noise estimation.

This class computes metrics for precursor isolation window purity (or noise). The function extracts the peaks from an isolation window targeted for fragmentation and determines which peaks are isotopes of the target and which come from other sources. The intensities of the assumed target peaks are summed up as the target intensity. Using this information it calculates an intensity ratio for the relative intensity of the target compared to other sources. These metrics are combined over the previous and the next MS1 spectrum.

Note
: If an MS1 spectrum does not contain the target peak within the given tolerance, all values are returned as 0.

Class Documentation

◆ OpenMS::PrecursorPurity::PurityScores

struct OpenMS::PrecursorPurity::PurityScores
Collaboration diagram for PrecursorPurity::PurityScores:
[legend]
Class Members
Size interfering_peak_count
PeakSpectrum interfering_peaks
double signal_proportion
double target_intensity
Size target_peak_count
double total_intensity

Member Function Documentation

◆ combinePrecursorPurities()

static PurityScores combinePrecursorPurities ( const PrecursorPurity::PurityScores score1,
const PrecursorPurity::PurityScores score2 
)
staticprivate

◆ computeInterpolatedPrecursorPurity()

static std::vector<double> computeInterpolatedPrecursorPurity ( int  ms2_spec_idx,
int  precursor_spec_idx,
int  next_ms1_spec_idx,
const MSExperiment exp,
double  max_precursor_isotope_deviation 
)
static

Computes a simple purity score aggregate for all Precursors (and their windows) of spectrum at ms2_spec_idx interpolated between precursor spectrum at precursor_spec_idx and the next parent type spectrum at next_ms1_spec_idx.

Interpolates by RT distances of ms2_spec_idx to the precursor_spec_idx and next_ms1_spec_idx. Extracts with fuzzy boundaries around expected isotopes where it only considers 50% of the intensity of the peak as belonging to the target. Warning: Does neither check if the relationship between those spectra make sense nor that all precursors windows in ms2_spec_idx even come from the same spectrum.

Note
If next_ms1_spec_idx is out of range, does not refer to an MS1 spectrum, or the RT denominator is zero/invalid, the function will fall back to returning the early scan purity (from precursor_spec_idx) without interpolation.
Parameters
ms2_spec_idxindex for the spectrum holding the precursor information
precursor_spec_idxindex for the precursor spectrum to extract the intensities from
next_ms1_spec_idxindex for the next parent type spectrum to extract the intensities from
expthe MSExperiment holding the spectra to look them up
max_precursor_isotope_deviationthe maximum allowed deviation for the precursor isotopes in ppm
Returns
std::vector<double> precursor intensity vs. total intensity for every precursor window in ms2_spec_idx

◆ computePrecursorPurities()

static std::map<String, PurityScores> computePrecursorPurities ( const PeakMap spectra,
double  precursor_mass_tolerance,
bool  precursor_mass_tolerance_unit_ppm,
bool  ignore_missing_precursor_spectra = false 
)
static

compute precursor purity metrics for each MS2 spectrum in a PeakMap This is the main function of this class. See class description. Note: Spectra annotated with charge 0 will be treated as charge 1.

Parameters
spectraA PeakMap containing MS1 and MS2 spectra in order of acquisition or measurement. The first spectrum must be an MS1.
precursor_mass_toleranceThe precursor tolerance. Is used for determining the targeted peak and deisotoping.
precursor_mass_tolerance_unit_ppmThe unit of the precursor tolerance
ignore_missing_precursor_spectraAllow MS2 spectra without a MS1 precursor spectrum (PurityScores for these spectra will be 0).

◆ computePrecursorPurity()

static PurityScores computePrecursorPurity ( const PeakSpectrum ms1,
const Precursor pre,
const double  precursor_mass_tolerance,
const bool  precursor_mass_tolerance_unit_ppm 
)
static

compute precursor purity metrics for one MS2 precursor

Note
This function is implemented in a general way and can also be used for e.g. MS3 precursor isolation windows in MS2 spectra. Spectra annotated with charge 0 will be treated as charge 1.
Parameters
ms1The Spectrum containing the isolation window
preThe precursor containing the definition the isolation window
precursor_mass_toleranceThe precursor tolerance. Is used for determining the targeted peak and deisotoping.
precursor_mass_tolerance_unit_ppmThe unit of the precursor tolerance

◆ computeSingleScanPrecursorPurities()

static std::vector<double> computeSingleScanPrecursorPurities ( int  ms2_spec_idx,
int  precursor_spec_idx,
const MSExperiment exp,
double  max_precursor_isotope_deviation 
)
static

Computes a simple purity score aggregate for all Precursors (and their windows) of spectrum at ms2_spec_idx in the precursor spectrum at precursor_spec_idx.

Extracts with fuzzy boundaries around expected isotopes where it only considers 50% of the intensity of the peak as belonging to the target. Warning: Does neither check if the relationship between those spectra make sense nor that all precursors windows in ms2_spec_idx even come from the same spectrum.

Parameters
ms2_spec_idxindex for the spectrum holding the precursor information
precursor_spec_idxindex for the precursor spectrum to extract the intensities from
expthe MSExperiment holding the spectra to look them up
max_precursor_isotope_deviationthe maximum allowed deviation for the precursor isotopes in ppm
Returns
std::vector<double> precursor intensity vs. total intensity for every precursor window in ms2_spec_idx