| OpenMS 2.5.0

Public Member Functions | Protected Member Functions | Private Types | List of all members
OpenSwathWorkflow Class Reference

Execute all steps in an OpenSwath analysis. More...

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

Inheritance diagram for OpenSwathWorkflow:

## Public Member Functions

| OpenSwathWorkflow (bool use_ms1_traces, bool use_ms1_ion_mobility, bool prm, int threads_outer_loop)
| Constructor. More...
void | performExtraction (const std::vector< OpenSwath::SwathMap > &swath_maps, const TransformationDescription trafo, const ChromExtractParams &chromatogram_extraction_params, const ChromExtractParams &ms1_chromatogram_extraction_params, const Param &feature_finder_param, const OpenSwath::LightTargetedExperiment &assay_library, FeatureMap &result_featureFile, bool store_features_in_featureFile, OpenSwathTSVWriter &result_tsv, OpenSwathOSWWriter &result_osw, Interfaces::IMSDataConsumer *result_chromatograms, int batchSize, int ms1_isotopes, bool load_into_memory)
| Execute OpenSWATH analysis on a set of SwathMaps and transitions. More...
Public Member Functions inherited from ProgressLogger
| ProgressLogger ()
| Constructor. More...
| ~ProgressLogger ()
| Destructor. More...
| ProgressLogger (const ProgressLogger &other)
| Copy constructor. More...
ProgressLogger & | operator= (const ProgressLogger &other)
| Assignment Operator. More...
void | setLogType (LogType type) const
| Sets the progress log that should be used. The default type is NONE! More...
LogType | getLogType () const
| Returns the type of progress log being used. More...
void | startProgress (SignedSize begin, SignedSize end, const String &label) const
| Initializes the progress display. More...
void | setProgress (SignedSize value) const
| Sets the current progress. More...
void | endProgress () const
| Ends the progress display. More...
void | nextProgress () const
| increment progress by 1 (according to range begin-end) More...

## Protected Member Functions

void | writeOutFeaturesAndChroms_ (std::vector< OpenMS::MSChromatogram > &chromatograms, const FeatureMap &featureFile, FeatureMap &out_featureFile, bool store_features, Interfaces::IMSDataConsumer *chromConsumer)
| Write output features and chromatograms. More...
void | scoreAllChromatograms_ (const std::vector< OpenMS::MSChromatogram > &ms2_chromatograms, const std::vector< OpenMS::MSChromatogram > &ms1_chromatograms, const std::vector< OpenSwath::SwathMap > &swath_maps, const OpenSwath::LightTargetedExperiment &transition_exp, const Param &feature_finder_param, TransformationDescription trafo, const double rt_extraction_window, FeatureMap &output, OpenSwathTSVWriter &tsv_writer, OpenSwathOSWWriter &osw_writer, int nr_ms1_isotopes=0, bool ms1only=false) const
| Perform scoring on a set of chromatograms. More...
void | selectCompoundsForBatch_ (const OpenSwath::LightTargetedExperiment &transition_exp_used_all, OpenSwath::LightTargetedExperiment &transition_exp_used, int batch_size, size_t batch_idx)
| Select which compounds to analyze in the next batch (and copy to output) More...
void | copyBatchTransitions_ (const std::vector< OpenSwath::LightCompound > &used_compounds, const std::vector< OpenSwath::LightTransition > &all_transitions, std::vector< OpenSwath::LightTransition > &output)
| Helper function for selectCompoundsForBatch_() More...
Protected Member Functions inherited from OpenSwathWorkflowBase
| OpenSwathWorkflowBase ()
| Default constructor. More...
| OpenSwathWorkflowBase (bool use_ms1_traces, bool use_ms1_ion_mobility, bool prm, int threads_outer_loop)
| Constructor. More...
void | MS1Extraction_ (const OpenSwath::SpectrumAccessPtr ms1_map, const std::vector< OpenSwath::SwathMap > &swath_maps, std::vector< MSChromatogram > &ms1_chromatograms, Interfaces::IMSDataConsumer *chromConsumer, const ChromExtractParams &cp, const OpenSwath::LightTargetedExperiment &transition_exp, const TransformationDescription &trafo_inverse, bool ms1only=false, int ms1_isotopes=0)
| Perform MS1 extraction and store result in ms1_chromatograms. More...
void | prepareExtractionCoordinates_ (std::vector< OpenSwath::ChromatogramPtr > &chrom_list, std::vector< ChromatogramExtractorAlgorithm::ExtractionCoordinates > &coordinates, const OpenSwath::LightTargetedExperiment &transition_exp_used, const TransformationDescription trafo_inverse, const ChromExtractParams &cp, const bool ms1=false, const int ms1_isotopes=-1) const
| Function to prepare extraction coordinates that also correctly handles RT transformations. More...

## Private Types

typedef OpenSwath::LightTransition | TransitionType
typedef MRMTransitionGroup< MSChromatogram, TransitionType > | MRMTransitionGroupType

## Additional Inherited Members

Public Types inherited from ProgressLogger
enum | LogType { CMD, GUI, NONE }
| Possible log types. More...
Static Protected Member Functions inherited from ProgressLogger
static String | logTypeToFactoryName_ (LogType type)
| Return the name of the factory product used for this log type. More...
Protected Attributes inherited from OpenSwathWorkflowBase
OpenSwath::SpectrumAccessPtr | ms1_map_ = nullptr
| Spectrum Access to the MS1 map (note that this is *not* threadsafe!) More...
bool | use_ms1_traces_
| Whether to use the MS1 traces. More...
bool | use_ms1_ion_mobility_
| Whether to use ion mobility extraction on MS1 traces. More...
bool | prm_
| Whether data is acquired in targeted DIA (e.g. PRM mode) with potentially overlapping windows. More...
int | threads_outer_loop_
| How many threads should be used for the outer loop. More...
Protected Attributes inherited from ProgressLogger
LogType | type_
time_t | last_invoke_
ProgressLoggerImpl * | current_logger_
Static Protected Attributes inherited from ProgressLogger
static int | recursion_depth_

## Detailed Description

Execute all steps in an OpenSwath analysis.

The workflow will perform a complete OpenSWATH analysis. Optionally, a calibration of m/z and retention time (mapping peptides to normalized space and correcting m/z error) can be performed beforehand using the OpenSwathCalibrationWorkflow class.

The overall execution flow in this class is as follows (see performExtraction() function)

- Obtain precursor ion chromatograms (if enabled) through MS1Extraction_()
- Perform scoring of precursor ion chromatograms if no MS2 is given
- Iterate through each SWATH-MS window:
  - Select which transitions to extract (proceed in batches) using OpenSwathHelper::selectSwathTransitions()
  - Iterate through each batch of transitions:
    - Extract current batch of transitions from current SWATH window:
      - Select transitions for current batch (see selectCompoundsForBatch_())
      - Prepare transition extraction (see prepareExtractionCoordinates_())
      - Extract transitions using ChromatogramExtractor::extractChromatograms()
      - Convert data to OpenMS format using ChromatogramExtractor::return_chromatogram()
    - Score extracted transitions (see scoreAllChromatograms_())
    - Write scored chromatograms and peak groups to disk (see writeOutFeaturesAndChroms_())

## Member Typedef Documentation

## ◆ MRMTransitionGroupType

typedef MRMTransitionGroup< MSChromatogram, TransitionType> MRMTransitionGroupType

private

## ◆ TransitionType

typedef OpenSwath::LightTransition TransitionType

private

## Constructor & Destructor Documentation

## ◆ OpenSwathWorkflow()

OpenSwathWorkflow | ( | bool | use_ms1_traces,
|  | bool | use_ms1_ion_mobility,
|  | bool | prm,
|  | int | threads_outer_loop
| ) |  |

inline

Constructor.

Parameters

  use_ms1_traces | Whether to use MS1 data
  use_ms1_ion_mobility | Whether to use ion mobility extraction on MS1 traces
  threads_outer_loop | How many threads should be used for the outer loop (-1 will use all threads in the outer loop)
  prm | Whether data is acquired in targeted DIA (e.g. PRM mode) with potentially overlapping windows

Note
  The total number of threads should be divisible by this number (e.g. use 8 in outer loop if you have 24 threads in total and 3 will be used for the inner loop).

## Member Function Documentation

## ◆ copyBatchTransitions_()

void copyBatchTransitions_ | ( | const std::vector< OpenSwath::LightCompound > & | used_compounds,
|  | const std::vector< OpenSwath::LightTransition > & | all_transitions,
|  | std::vector< OpenSwath::LightTransition > & | output
| ) |  |

protected

Helper function for selectCompoundsForBatch_()

Copy all transitions matching to one of the compounds in the selected peptide vector from all_transitions to the output.

Parameters

  used_compounds | Which peptides or metabolites to be used
  all_transitions | Transitions vector from which to select transitions
  output | Output vector containing matching transitions (taken from all_transitions)

## ◆ performExtraction()

void performExtraction | ( | const std::vector< OpenSwath::SwathMap > & | swath_maps,
|  | const TransformationDescription | trafo,
|  | const ChromExtractParams & | chromatogram_extraction_params,
|  | const ChromExtractParams & | ms1_chromatogram_extraction_params,
|  | const Param & | feature_finder_param,
|  | const OpenSwath::LightTargetedExperiment & | assay_library,
|  | FeatureMap & | result_featureFile,
|  | bool | store_features_in_featureFile,
|  | OpenSwathTSVWriter & | result_tsv,
|  | OpenSwathOSWWriter & | result_osw,
|  | Interfaces::IMSDataConsumer * | result_chromatograms,
|  | int | batchSize,
|  | int | ms1_isotopes,
|  | bool | load_into_memory
| ) |  |

Execute OpenSWATH analysis on a set of SwathMaps and transitions.

See OpenSwathWorkflow class for a detailed description of this function.

Parameters

  swath_maps | The raw data (swath maps)
  rt_trafo | Retention time transformation description (translating this runs' RT to normalized RT space)
  chromatogram_extraction_params | Parameter set for the chromatogram extraction
  ms1_chromatogram_extraction_params | Parameter set for the chromatogram extraction of the MS1 data
  feature_finder_param | Parameter set for the feature finding in chromatographic dimension
  assay_library | The set of assays to be extracted and scored
  result_featureFile | Output feature map to store identified features
  store_features_in_featureFile | Whether features should be appended to the output feature map (if this is false, then out_featureFile will be empty)
  result_tsv | TSV Writer object to store identified features in csv format (set store_features to false if using this option)
  result_osw | OSW Writer object to store identified features in SQLite format (set store_features to false if using this option)
  result_chromatograms | Chromatogram consumer object to store the extracted chromatograms
  batchSize | Size of the batches which should be extracted and scored
  int | ms1_isotopes Number of MS1 isotopes to extract (zero means only monoisotopic peak)
  load_into_memory | Whether to cache the current SWATH map in memory

Note
  Speed and memory performance can be influenced by `batchSize` and `load_into_memory` where larger batch sizes increase memory and potentially decrease the utility of parallelization while loading data into memory will increase memory usage but decrease execution time.

## ◆ scoreAllChromatograms_()

void scoreAllChromatograms_ | ( | const std::vector< OpenMS::MSChromatogram > & | ms2_chromatograms,
|  | const std::vector< OpenMS::MSChromatogram > & | ms1_chromatograms,
|  | const std::vector< OpenSwath::SwathMap > & | swath_maps,
|  | const OpenSwath::LightTargetedExperiment & | transition_exp,
|  | const Param & | feature_finder_param,
|  | TransformationDescription | trafo,
|  | const double | rt_extraction_window,
|  | FeatureMap & | output,
|  | OpenSwathTSVWriter & | tsv_writer,
|  | OpenSwathOSWWriter & | osw_writer,
|  | int | nr_ms1_isotopes = `0`,
|  | bool | ms1only = `false`
| ) |  | const

protected

Perform scoring on a set of chromatograms.

This will generate a new object of type MRMTransitionGroup for each compound or peptide in the provided assay library and link the transition meta information with the extracted chromatograms. This will then be used to perform peak picking and peak scoring through MRMTransitionGroupPicker and MRMFeatureFinderScoring. The assay library is provided as transition_exp and the chromatograms in ms2_chromatograms.

The overall execution flow is as follows:

- Iterate over all assays (compounds / peptides) in the transition_exp
  - Create a new MRMTransitionGroup
  - Iterate over all transitions in an assay
    - Find the relevant chromatogram for the given transition, convert it and filter it by RT
    - Add the chromatogram and transition to the MRMTransitionGroup
  - Add a single MS1 chromatogram of the mono-isotopic precursor to the MRMTransitionGroup, if available (named "groupId_Precursor_i0")
  - Find peakgroups in the chromatogram set (see MRMTransitionGroupPicker::pickTransitionGroup)
  - Score peakgroups in the chromatogram set (see MRMFeatureFinderScoring::scorePeakgroups)
  - Add the identified peak groups to the TSV writer (tsv_writer) and the SQL-based output format (osw_writer)

Parameters

  ms2_chromatograms | Input chromatograms (MS2 level)
  ms1_chromatograms | Input chromatograms (MS1-level)
  swath_maps | Set of swath map(s) for the current swath window (for SONAR multiple maps are provided)
  transition_exp | The transition experiment (assay library)
  feature_finder_param | Parameters for the MRMFeatureFinderScoring
  trafo | RT Transformation function
  rt_extraction_window | RT extraction window
  output | Output map
  tsv_writer | TSV writer for storing output (on the fly)
  osw_writer | OSW Writer object to store identified features in SQLite format
  ms1only | If true, will only score on MS1 level and ignore MS2 level

## ◆ selectCompoundsForBatch_()

void selectCompoundsForBatch_ | ( | const OpenSwath::LightTargetedExperiment & | transition_exp_used_all,
|  | OpenSwath::LightTargetedExperiment & | transition_exp_used,
|  | int | batch_size,
|  | size_t | batch_idx
| ) |  |

protected

Select which compounds to analyze in the next batch (and copy to output)

This function will select which compounds or peptides should be analyzed in the current batch (with index "batch_idx"). The selected compounds will be copied into the output structure. The output will contain "batch_size" compounds or peptides.

Parameters

  transition_exp_used_all | The full set of transitions (this will be used to select transitions from)
  transition_exp_used | The selected set of transitions (will contain only transitions for the next batch)
  batch_size | How many compounds or peptides should be used per batch
  batch_idx | Current batch index (only compounds or peptides from batch_idx*batch_size to batch_idx*batch_size+batch_size will be copied)

Note
  The proteins will be copied completely without checking for a match

## ◆ writeOutFeaturesAndChroms_()

void writeOutFeaturesAndChroms_ | ( | std::vector< OpenMS::MSChromatogram > & | chromatograms,
|  | const FeatureMap & | featureFile,
|  | FeatureMap & | out_featureFile,
|  | bool | store_features,
|  | Interfaces::IMSDataConsumer * | chromConsumer
| ) |  |

protected

Write output features and chromatograms.

Writes output chromatograms to the provided chromatogram consumer (presumably to disk) and output features to the provided FeatureMap.

Parameters

  chromatograms | Output chromatograms to be passed to the consumer
  featureFile | Features to be appended to the output FeatureMap
  out_featureFile | Output FeatureMap to which the features will be appended
  store_features | Whether features should be appended to the output feature map (if this is false, then out_featureFile will be empty)
  chromConsumer | Chromatogram consumer object to store the extracted chromatograms

Note
  This should be wrapped in an OpenMP critical block