OpenMS
OpenSwathScoring Class Reference

A class that calls the scoring routines. More...

#include <OpenMS/ANALYSIS/OPENSWATH/OpenSwathScoring.h>

Collaboration diagram for OpenSwathScoring:
[legend]

Public Member Functions

 OpenSwathScoring ()
 Constructor. More...
 
 ~OpenSwathScoring ()
 Destructor. More...
 
void initialize (double rt_normalization_factor, int add_up_spectra, double spacing_for_spectra_resampling, const double drift_extra, const OpenSwath_Scores_Usage &su, const std::string &spectrum_addition_method, bool use_ms1_ion_mobility)
 Initialize the scoring object. More...
 
void calculateChromatographicScores (OpenSwath::IMRMFeature *imrmfeature, const std::vector< std::string > &native_ids, const std::vector< std::string > &precursor_ids, const std::vector< double > &normalized_library_intensity, std::vector< OpenSwath::ISignalToNoisePtr > &signal_noise_estimators, OpenSwath_Scores &scores) const
 Score a single peakgroup in a chromatogram using only chromatographic properties. More...
 
void calculateChromatographicIdScores (OpenSwath::IMRMFeature *imrmfeature, const std::vector< std::string > &native_ids_identification, const std::vector< std::string > &native_ids_detection, std::vector< OpenSwath::ISignalToNoisePtr > &signal_noise_estimators, OpenSwath_Ind_Scores &scores) const
 Score identification transitions against detection transitions of a single peakgroup in a chromatogram using only chromatographic properties. More...
 
void calculateLibraryScores (OpenSwath::IMRMFeature *imrmfeature, const std::vector< TransitionType > &transitions, const CompoundType &compound, const double normalized_feature_rt, OpenSwath_Scores &scores)
 Score a single chromatographic feature against a spectral library. More...
 
void calculateDIAScores (OpenSwath::IMRMFeature *imrmfeature, const std::vector< TransitionType > &transitions, const std::vector< OpenSwath::SwathMap > &swath_maps, const OpenSwath::SpectrumAccessPtr &ms1_map, const OpenMS::DIAScoring &diascoring, const CompoundType &compound, OpenSwath_Scores &scores, std::vector< double > &mzerror_ppm, const double drift_target, const RangeMobility &range_im)
 Score a single chromatographic feature using DIA / SWATH scores. More...
 
void calculatePrecursorDIAScores (const OpenSwath::SpectrumAccessPtr &ms1_map, const OpenMS::DIAScoring &diascoring, double precursor_mz, double rt, const CompoundType &compound, RangeMobility im_range, OpenSwath_Scores &scores)
 Score a single chromatographic feature using the precursor map. More...
 
void calculateDIAIdScores (OpenSwath::IMRMFeature *imrmfeature, const TransitionType &transition, const std::vector< OpenSwath::SwathMap > &swath_maps, RangeMobility &range_im, const OpenMS::DIAScoring &diascoring, OpenSwath_Scores &scores)
 Score a single chromatographic feature using DIA / SWATH scores. More...
 
void getNormalized_library_intensities_ (const std::vector< TransitionType > &transitions, std::vector< double > &normalized_library_intensity)
 Computing the normalized library intensities from the transition objects. More...
 
SpectrumSequence fetchSpectrumSwath (std::vector< OpenSwath::SwathMap > swath_maps, double RT, int nr_spectra_to_add, const RangeMobility &im_range)
 Prepares a spectrum for DIA analysis (single map) More...
 
SpectrumSequence fetchSpectrumSwath (OpenSwath::SpectrumAccessPtr swath_map, double RT, int nr_spectra_to_add, const RangeMobility &im_range)
 Prepares a spectrum for DIA analysis (multiple map) More...
 

Private Types

enum class  SpectrumAdditionMethod { ADDITION , RESAMPLE }
 
typedef OpenSwath::LightCompound CompoundType
 
typedef OpenSwath::LightTransition TransitionType
 

Private Attributes

double rt_normalization_factor_
 
double spacing_for_spectra_resampling_
 
int add_up_spectra_
 
SpectrumAdditionMethod spectra_addition_method_
 
double im_drift_extra_pcnt_
 
OpenSwath_Scores_Usage su_
 
bool use_ms1_ion_mobility_
 whether to use MS1 ion mobility extraction in DIA scores More...
 
const std::string ION_MOBILITY_DESCRIPTION = "Ion Mobility"
 

Detailed Description

A class that calls the scoring routines.

Use this class to invoke the individual OpenSWATH scoring routines.

Member Typedef Documentation

◆ CompoundType

◆ TransitionType

Member Enumeration Documentation

◆ SpectrumAdditionMethod

enum SpectrumAdditionMethod
strongprivate
Enumerator
ADDITION 
RESAMPLE 

Constructor & Destructor Documentation

◆ OpenSwathScoring()

Constructor.

◆ ~OpenSwathScoring()

Destructor.

Member Function Documentation

◆ calculateChromatographicIdScores()

void calculateChromatographicIdScores ( OpenSwath::IMRMFeature imrmfeature,
const std::vector< std::string > &  native_ids_identification,
const std::vector< std::string > &  native_ids_detection,
std::vector< OpenSwath::ISignalToNoisePtr > &  signal_noise_estimators,
OpenSwath_Ind_Scores scores 
) const

Score identification transitions against detection transitions of a single peakgroup in a chromatogram using only chromatographic properties.

This function only uses the chromatographic properties (coelution, signal to noise, etc.) of a peakgroup in a chromatogram to compute scores. The scores are computed by scoring identification against detection transitions.

The scores are returned in the OpenSwath_Scores object. Only those scores specified in the OpenSwath_Scores_Usage object are computed.

Parameters
imrmfeatureThe feature to be scored
native_ids_identificationThe list of identification native ids (giving a canonical ordering of the transitions)
native_ids_detectionThe list of detection native ids (giving a canonical ordering of the transitions)
signal_noise_estimatorsThe signal-to-noise estimators for each transition
scoresThe object to store the result

◆ calculateChromatographicScores()

void calculateChromatographicScores ( OpenSwath::IMRMFeature imrmfeature,
const std::vector< std::string > &  native_ids,
const std::vector< std::string > &  precursor_ids,
const std::vector< double > &  normalized_library_intensity,
std::vector< OpenSwath::ISignalToNoisePtr > &  signal_noise_estimators,
OpenSwath_Scores scores 
) const

Score a single peakgroup in a chromatogram using only chromatographic properties.

This function only uses the chromatographic properties (coelution, signal to noise, etc.) of a peakgroup in a chromatogram to compute scores. If more information is available, also consider using the library based scoring and the full-spectrum based scoring.

The scores are returned in the OpenSwath_Scores object. Only those scores specified in the OpenSwath_Scores_Usage object are computed.

Parameters
imrmfeatureThe feature to be scored
native_idsThe list of native ids (giving a canonical ordering of the transitions)
precursor_idsThe list of precursor ids
normalized_library_intensityThe weights to be used for each transition (e.g. normalized library intensities)
signal_noise_estimatorsThe signal-to-noise estimators for each transition
scoresThe object to store the result

◆ calculateDIAIdScores()

void calculateDIAIdScores ( OpenSwath::IMRMFeature imrmfeature,
const TransitionType transition,
const std::vector< OpenSwath::SwathMap > &  swath_maps,
RangeMobility range_im,
const OpenMS::DIAScoring diascoring,
OpenSwath_Scores scores 
)

Score a single chromatographic feature using DIA / SWATH scores.

The scores are returned in the OpenSwath_Scores object.

Parameters
imrmfeatureThe feature to be scored
transitionThe library transition to score the feature against
swath_mapsThe SWATH-MS (DIA) maps from which to retrieve full MS/MS spectra at the chromatographic peak apices
range_imdrift time lower and upper bounds
diascoringDIA Scoring object to use for scoring
scoresThe object to store the result

◆ calculateDIAScores()

void calculateDIAScores ( OpenSwath::IMRMFeature imrmfeature,
const std::vector< TransitionType > &  transitions,
const std::vector< OpenSwath::SwathMap > &  swath_maps,
const OpenSwath::SpectrumAccessPtr ms1_map,
const OpenMS::DIAScoring diascoring,
const CompoundType compound,
OpenSwath_Scores scores,
std::vector< double > &  mzerror_ppm,
const double  drift_target,
const RangeMobility range_im 
)

Score a single chromatographic feature using DIA / SWATH scores.

The scores are returned in the OpenSwath_Scores object.

Parameters
imrmfeatureThe feature to be scored
transitionsThe library transition to score the feature against
swath_mapsThe SWATH-MS (DIA) maps from which to retrieve full MS/MS spectra at the chromatographic peak apices
ms1_mapThe corresponding MS1 (precursor ion map) from which the precursor spectra can be retrieved (optional, may be NULL)
diascoringDIA Scoring object to use for scoring
compoundThe compound corresponding to the library transitions
scoresThe object to store the result
mzerror_ppmm/z and mass error (in ppm) for all transitions
[in]drift_targettarget drift value
[in]range_imdrift time lower and upper bounds

◆ calculateLibraryScores()

void calculateLibraryScores ( OpenSwath::IMRMFeature imrmfeature,
const std::vector< TransitionType > &  transitions,
const CompoundType compound,
const double  normalized_feature_rt,
OpenSwath_Scores scores 
)

Score a single chromatographic feature against a spectral library.

The spectral library is provided in a set of transition objects and a peptide object. Both contain information about the expected elution time on the chromatography and the relative intensity of the transitions.

The scores are returned in the OpenSwath_Scores object.

Parameters
imrmfeatureThe feature to be scored
transitionsThe library transition to score the feature against
compoundThe compound corresponding to the library transitions
normalized_feature_rtThe retention time of the feature in normalized space
scoresThe object to store the result

◆ calculatePrecursorDIAScores()

void calculatePrecursorDIAScores ( const OpenSwath::SpectrumAccessPtr ms1_map,
const OpenMS::DIAScoring diascoring,
double  precursor_mz,
double  rt,
const CompoundType compound,
RangeMobility  im_range,
OpenSwath_Scores scores 
)

Score a single chromatographic feature using the precursor map.

The scores are returned in the OpenSwath_Scores object.

Parameters
ms1_mapThe MS1 (precursor ion map) from which the precursor spectra can be retrieved
diascoringDIA Scoring object to use for scoring
precursor_mzThe m/z ratio of the precursor
rtThe compound retention time
compoundthe compound sequence
im_rangedrift time lower and upper bounds
scoresThe object to store the result

◆ fetchSpectrumSwath() [1/2]

SpectrumSequence fetchSpectrumSwath ( OpenSwath::SpectrumAccessPtr  swath_map,
double  RT,
int  nr_spectra_to_add,
const RangeMobility im_range 
)

Prepares a spectrum for DIA analysis (multiple map)

This function will fetch a SpectrumSequence to be used in DIA analysis. If nr_spectra_to_add == 1, then a vector of length 1 will be returned. Spectra are prepared differently based on the condition Case #1: "simple" addition selected - Array of length "nr_spectra_to_add" returned corresponding with "nr_spectra_to_add" spectra Case #2: "resampling addition selected - Array of length 1 of the resampled spectrum returned

For case #2 result is all spectra summed up (add) with the intensities of multiple spectra a single swath map (assuming these are regular SWATH / DIA maps) around the given retention time and return an "averaged" spectrum which may contain less noise. Spectra are also filtered and summed across drift time to transform an ion mobility spectrum into a non ion mobility spectrum

For case #1 this processing is done downstream in DIA scores to speed up computation time, furthermore drift time filtering is done downstream (these parameters are ignored)

Parameters
[in]swath_mapThe map containing the spectra
[in]RTThe target retention time
[in]nr_spectra_to_addHow many spectra to add up
[in]im_rangemobility range, only used if resampling spectrum addition chosen
Returns
Vector of spectra to be used

◆ fetchSpectrumSwath() [2/2]

SpectrumSequence fetchSpectrumSwath ( std::vector< OpenSwath::SwathMap swath_maps,
double  RT,
int  nr_spectra_to_add,
const RangeMobility im_range 
)

Prepares a spectrum for DIA analysis (single map)

This function will fetch a vector of spectrum pointers to be used in DIA analysis. If nr_spectra_to_add == 1, then a vector of length 1 will be returned

  • Case #1: "simple" addition selected - Array of length "nr_spectra_to_add" returned corresponding with "nr_spectra_to_add" spectra
  • Case #2: "resampling addition selected - Array of length 1 of the resampled spectrum returned

For case #2 result is all spectra summed up (add) with the intensities of multiple spectra a single swath map (assuming these are regular SWATH / DIA maps) around the given retention time and return an "averaged" spectrum which may contain less noise.

For case #1 this processing is done downstream in DIA scores to speed up computation time

Parameters
[in]swath_mapsThe map containing the spectra
[in]RTThe target retention time
[in]nr_spectra_to_addHow many spectra to add up
[in]im_rangeDrift time lower and upper bounds
Returns
Vector of spectra to be used

◆ getNormalized_library_intensities_()

void getNormalized_library_intensities_ ( const std::vector< TransitionType > &  transitions,
std::vector< double > &  normalized_library_intensity 
)

Computing the normalized library intensities from the transition objects.

The intensities are normalized such that the sum to one.

Parameters
[in]transitionsThe library transition to score the feature against
[out]normalized_library_intensityThe resulting normalized library intensities

◆ initialize()

void initialize ( double  rt_normalization_factor,
int  add_up_spectra,
double  spacing_for_spectra_resampling,
const double  drift_extra,
const OpenSwath_Scores_Usage su,
const std::string &  spectrum_addition_method,
bool  use_ms1_ion_mobility 
)

Initialize the scoring object.

Sets the parameters for the scoring.

Parameters
rt_normalization_factorSpecifies the range of the normalized retention time space
add_up_spectraHow many spectra to add up (default 1)
spacing_for_spectra_resamplingSpacing factor for spectra addition
drift_extraExtend the extraction window to gain a larger field of view beyond drift_upper - drift_lower (in percent)
suWhich scores to actually compute
spectrum_addition_methodMethod to use for spectrum addition (valid: "simple", "resample")
use_ms1_ion_mobilityUse MS1 ion mobility extraction in DIA scores

Member Data Documentation

◆ add_up_spectra_

int add_up_spectra_
private

◆ im_drift_extra_pcnt_

double im_drift_extra_pcnt_
private

◆ ION_MOBILITY_DESCRIPTION

const std::string ION_MOBILITY_DESCRIPTION = "Ion Mobility"
private

◆ rt_normalization_factor_

double rt_normalization_factor_
private

◆ spacing_for_spectra_resampling_

double spacing_for_spectra_resampling_
private

◆ spectra_addition_method_

SpectrumAdditionMethod spectra_addition_method_
private

◆ su_

◆ use_ms1_ion_mobility_

bool use_ms1_ion_mobility_
private

whether to use MS1 ion mobility extraction in DIA scores