OpenMS
OpenSwathHelper Class Reference

A helper class that is used by several OpenSWATH tools. More...

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

Static Public Member Functions

static String computePrecursorId (const String &transition_group_id, int isotope)
 Compute unique precursor identifier. More...
 
static String computeTransitionGroupId (const String &precursor_id)
 Compute transition group id. More...
 
static void selectSwathTransitions (const OpenMS::TargetedExperiment &targeted_exp, OpenMS::TargetedExperiment &selected_transitions, double min_upper_edge_dist, double lower, double upper)
 Select transitions between lower and upper and write them into the new TargetedExperiment. More...
 
static void selectSwathTransitions (const OpenSwath::LightTargetedExperiment &targeted_exp, OpenSwath::LightTargetedExperiment &selected_transitions, double min_upper_edge_dist, double lower, double upper)
 Select transitions between lower and upper and write them into the new TargetedExperiment. More...
 
static void selectSwathTransitionsPasef (const OpenSwath::LightTargetedExperiment &transition_exp, std::vector< int > &tr_win_map, double min_upper_edge_dist, const std::vector< OpenSwath::SwathMap > &swath_maps)
 Match transitions with their "best" window across m/z and ion mobility, save results in a vector. More...
 
static void checkSwathMap (const OpenMS::PeakMap &swath_map, double &lower, double &upper, double &center)
 Get the lower / upper offset for this SWATH map and do some sanity checks. More...
 
template<class TargetedExperimentT >
static bool checkSwathMapAndSelectTransitions (const OpenMS::PeakMap &exp, const TargetedExperimentT &targeted_exp, TargetedExperimentT &selected_transitions, double min_upper_edge_dist)
 Check the map and select transition in one function. More...
 
static std::pair< double, double > estimateRTRange (const OpenSwath::LightTargetedExperiment &exp)
 Computes the min and max retention time value. More...
 
static std::map< std::string, double > simpleFindBestFeature (const OpenMS::MRMFeatureFinderScoring::TransitionGroupMapType &transition_group_map, bool useQualCutoff=false, double qualCutoff=0.0)
 Returns the feature with the highest score for each transition group. More...
 

Detailed Description

A helper class that is used by several OpenSWATH tools.

Member Function Documentation

◆ checkSwathMap()

static void checkSwathMap ( const OpenMS::PeakMap swath_map,
double &  lower,
double &  upper,
double &  center 
)
static

Get the lower / upper offset for this SWATH map and do some sanity checks.

Sanity check for the whole map:

  • all scans need to have exactly one precursor
  • all scans need to have the same MS levels (otherwise extracting an XIC from them makes no sense)
  • all scans need to have the same precursor isolation window (otherwise extracting an XIC from them makes no sense)
Parameters
[in]swath_mapInput SWATH map to check
[out]lowerLower edge of SWATH window (in Th)
[out]upperUpper edge of SWATH window (in Th)
[out]centerCenter of SWATH window (in Th)
Exceptions
IllegalArgumentexception if the sanity checks fail.

Referenced by OpenSwathHelper::checkSwathMapAndSelectTransitions().

◆ checkSwathMapAndSelectTransitions()

static bool checkSwathMapAndSelectTransitions ( const OpenMS::PeakMap exp,
const TargetedExperimentT &  targeted_exp,
TargetedExperimentT &  selected_transitions,
double  min_upper_edge_dist 
)
inlinestatic

Check the map and select transition in one function.

Computes lower and upper offset for the SWATH map and performs some sanity checks (see checkSwathMap()). Then selects transitions.

Parameters
[in]expInput SWATH map to check
[in]targeted_expTransition list for selection
[out]selected_transitionsSelected transitions for SWATH window
[in]min_upper_edge_distDistance in Th to the upper edge

References OpenSwathHelper::checkSwathMap(), MSExperiment::empty(), DocumentIdentifier::getLoadedFilePath(), and OpenSwathHelper::selectSwathTransitions().

◆ computePrecursorId()

static String computePrecursorId ( const String transition_group_id,
int  isotope 
)
inlinestatic

Compute unique precursor identifier.

Uses transition_group_id and isotope number to compute a unique precursor id of the form "groupID_Precursor_ix" where x is the isotope number, e.g. the monoisotopic precursor would become "groupID_Precursor_i0".

Parameters
[in]transition_group_idUnique id of the transition group (peptide/compound)
[in]isotopePrecursor isotope number
Returns
Unique precursor identifier

◆ computeTransitionGroupId()

static String computeTransitionGroupId ( const String precursor_id)
inlinestatic

Compute transition group id.

Uses the unique precursor identifier to compute the transition group id (peptide/compound identifier), reversing the operation performed by computePrecursorId().

Parameters
[in]precursor_idPrecursor identifier as computed by computePrecursorId()
Returns
Original transition group id

References OpenMS::Constants::k, String::prefix(), and String::split().

Referenced by ChromatogramExtractor::return_chromatogram().

◆ estimateRTRange()

static std::pair<double,double> estimateRTRange ( const OpenSwath::LightTargetedExperiment exp)
static

Computes the min and max retention time value.

Estimate the retention time span of a targeted experiment by returning the min/max values in retention time as a pair.

Returns
A std::pair that contains (min,max)

◆ selectSwathTransitions() [1/2]

static void selectSwathTransitions ( const OpenMS::TargetedExperiment targeted_exp,
OpenMS::TargetedExperiment selected_transitions,
double  min_upper_edge_dist,
double  lower,
double  upper 
)
static

Select transitions between lower and upper and write them into the new TargetedExperiment.

Version for the OpenMS TargetedExperiment

Parameters
[in]targeted_expTransition list for selection
[out]selected_transitionsSelected transitions for SWATH window
[in]min_upper_edge_distDistance in Th to the upper edge
[in]lowerLower edge of SWATH window (in Th)
[in]upperUpper edge of SWATH window (in Th)

Referenced by OpenSwathHelper::checkSwathMapAndSelectTransitions().

◆ selectSwathTransitions() [2/2]

static void selectSwathTransitions ( const OpenSwath::LightTargetedExperiment targeted_exp,
OpenSwath::LightTargetedExperiment selected_transitions,
double  min_upper_edge_dist,
double  lower,
double  upper 
)
static

Select transitions between lower and upper and write them into the new TargetedExperiment.

Version for the LightTargetedExperiment

Parameters
[in]targeted_expTransition list for selection
[out]selected_transitionsSelected transitions for SWATH window
[in]min_upper_edge_distDistance in Th to the upper edge
[in]lowerLower edge of SWATH window (in Th)
[in]upperUpper edge of SWATH window (in Th)

◆ selectSwathTransitionsPasef()

static void selectSwathTransitionsPasef ( const OpenSwath::LightTargetedExperiment transition_exp,
std::vector< int > &  tr_win_map,
double  min_upper_edge_dist,
const std::vector< OpenSwath::SwathMap > &  swath_maps 
)
static

Match transitions with their "best" window across m/z and ion mobility, save results in a vector.

Parameters
[in]transition_expTransition list for selection
[out]tr_win_mapMapping from transition (index) to the best matching entry in swath_maps
[in]min_upper_edge_distDistance in Th to the upper edge
[in]swath_mapsvector of SwathMap objects defining mz and im bounds

◆ simpleFindBestFeature()

static std::map<std::string, double> simpleFindBestFeature ( const OpenMS::MRMFeatureFinderScoring::TransitionGroupMapType transition_group_map,
bool  useQualCutoff = false,
double  qualCutoff = 0.0 
)
static

Returns the feature with the highest score for each transition group.

Simple method to extract the best feature for each transition group (e.g. for RT alignment). A quality cutoff can be used to skip some low-quality features altogether.

Parameters
[in]transition_group_mapInput data containing the picked and scored map
useQualCutoffWhether to apply a quality cutoff to the data
qualCutoffWhat quality cutoff should be applied (all data above the cutoff will be kept)
Returns
Result of the best scoring peaks (stored as map of peptide id and RT)