Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | List of all members
OpenSwathWorkflow Class Reference

Class to execute an OpenSwath Workflow. More...

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

Inheritance diagram for OpenSwathWorkflow:
ProgressLogger OpenSwathWorkflowSonar

Public Member Functions

 OpenSwathWorkflow (bool use_ms1_traces)
 
void performExtraction (const std::vector< OpenSwath::SwathMap > &swath_maps, const TransformationDescription trafo, const ChromExtractParams &cp, const Param &feature_finder_param, const OpenSwath::LightTargetedExperiment &transition_exp, FeatureMap &out_featureFile, bool store_features, OpenSwathTSVWriter &tsv_writer, OpenSwathOSWWriter &osw_writer, Interfaces::IMSDataConsumer *chromConsumer, int batchSize, bool load_into_memory)
 Execute the OpenSWATH workflow 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...
 
ProgressLoggeroperator= (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...
 

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 to disk. More...
 
void MS1Extraction_ (const std::vector< OpenSwath::SwathMap > &swath_maps, std::map< std::string, OpenSwath::ChromatogramPtr > &ms1_chromatograms, Interfaces::IMSDataConsumer *chromConsumer, const ChromExtractParams &cp, const OpenSwath::LightTargetedExperiment &transition_exp, const TransformationDescription &trafo_inverse, bool load_into_memory, bool ms1only=false)
 Perform MS1 extraction and store result in ms1_chromatograms. More...
 
void scoreAllChromatograms (const OpenSwath::SpectrumAccessPtr input, const std::map< std::string, OpenSwath::ChromatogramPtr > &ms1_chromatograms, const std::vector< OpenSwath::SwathMap > swath_maps, OpenSwath::LightTargetedExperiment &transition_exp, const Param &feature_finder_param, TransformationDescription trafo, const double rt_extraction_window, FeatureMap &output, OpenSwathTSVWriter &tsv_writer, OpenSwathOSWWriter &osw_writer, bool ms1only=false)
 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 j)
 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)
 Copy the required transitions to output. More...
 
void prepareExtractionCoordinates_ (std::vector< OpenSwath::ChromatogramPtr > &chrom_list, std::vector< ChromatogramExtractorAlgorithm::ExtractionCoordinates > &coordinates, const OpenSwath::LightTargetedExperiment &transition_exp_used, const bool ms1, const TransformationDescription trafo_inverse, const ChromExtractParams &cp) const
 Function to prepare extraction coordinates that also correctly handles RT transformations. More...
 
void prepare_coordinates_sub (std::vector< OpenSwath::ChromatogramPtr > &output_chromatograms, std::vector< ChromatogramExtractorAlgorithm::ExtractionCoordinates > &coordinates, const OpenSwath::LightTargetedExperiment &transition_exp_used, const double rt_extraction_window, const bool ms1) const
 Simple function to prepare extraction coordinates. More...
 

Protected Attributes

OpenSwath::SpectrumAccessPtr ms1_map_
 Spectrum Access to the MS1 map (note that this is *not* threadsafe!) More...
 
bool use_ms1_traces_
 Whether to use the MS1 traces. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 

Private Types

typedef OpenSwath::LightTransition TransitionType
 
typedef MRMTransitionGroup< MSChromatogram, TransitionTypeMRMTransitionGroupType
 

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...
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Class to execute an OpenSwath Workflow.

The workflow will perform a complete OpenSWATH analysis. Optionally, an RT transformation (mapping peptides to normalized space) can be obtained beforehand using the OpenSwathRetentionTimeNormalization class.

Member Typedef Documentation

◆ MRMTransitionGroupType

◆ TransitionType

Constructor & Destructor Documentation

◆ OpenSwathWorkflow()

OpenSwathWorkflow ( bool  use_ms1_traces)
inlineexplicit

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

Copy the required transitions to output.

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

Parameters
used_compoundsWhich peptides or metabolites to be used
all_transitionsTransitions vector from which to select transitions
outputOutput vector containing matching transitions (taken from all_transitions)

◆ MS1Extraction_()

void MS1Extraction_ ( const std::vector< OpenSwath::SwathMap > &  swath_maps,
std::map< std::string, OpenSwath::ChromatogramPtr > &  ms1_chromatograms,
Interfaces::IMSDataConsumer chromConsumer,
const ChromExtractParams cp,
const OpenSwath::LightTargetedExperiment transition_exp,
const TransformationDescription trafo_inverse,
bool  load_into_memory,
bool  ms1only = false 
)
protected

Perform MS1 extraction and store result in ms1_chromatograms.

◆ performExtraction()

void performExtraction ( const std::vector< OpenSwath::SwathMap > &  swath_maps,
const TransformationDescription  trafo,
const ChromExtractParams cp,
const Param feature_finder_param,
const OpenSwath::LightTargetedExperiment transition_exp,
FeatureMap out_featureFile,
bool  store_features,
OpenSwathTSVWriter tsv_writer,
OpenSwathOSWWriter osw_writer,
Interfaces::IMSDataConsumer chromConsumer,
int  batchSize,
bool  load_into_memory 
)

Execute the OpenSWATH workflow on a set of SwathMaps and transitions.

Executes the following operations on the given input:

1. Selecting the appropriate transitions for each SWATH window (using OpenSwathHelper::selectSwathTransitions) 2. Extract the chromatograms from the SWATH maps (MS1 and MS2) using (ChromatogramExtractor) 3. Pick peaks in the chromatograms and perform peak scoring (inside scoreAllChromatograms function) 4. Write out chromatograms and found features

Parameters
swath_mapsThe raw data (swath maps)
trafoTransformation description (translating this runs' RT to normalized RT space)
cpParameter set for the chromatogram extraction
feature_finder_paramParameter set for the feature finding in chromatographic dimension
transition_expThe set of assays to be extracted and scored
out_featureFileOutput feature map to store identified features
store_featuresWhether features should be appended to the output feature map
tsv_writerTSV Writer object to store identified features in csv format
osw_writerOSW Writer object to store identified features in SQLite format
chromConsumerChromatogram consumer object to store the extracted chromatograms
batchSizeSize of the batches which should be extracted and scored
load_into_memoryWhether to cache the current SWATH map in memory

Referenced by SortPairDoubleByFirst().

◆ prepare_coordinates_sub()

void prepare_coordinates_sub ( std::vector< OpenSwath::ChromatogramPtr > &  output_chromatograms,
std::vector< ChromatogramExtractorAlgorithm::ExtractionCoordinates > &  coordinates,
const OpenSwath::LightTargetedExperiment transition_exp_used,
const double  rt_extraction_window,
const bool  ms1 
) const
protected

Simple function to prepare extraction coordinates.

This will take the targeted experiment and prepare extraction coordinates (either MS1 or MS2) for extraction by the ChromatogramExtractor.

Parameters
output_chromatogramsOutput of chromatograms (will be filled with empty chromatogram ptrs)
coordinatesOutput of extraction coordinates (will be filled with matching extraction coordinates)
transition_exp_usedThe transition experiment used to create the coordinates
rt_extraction_windowWindow for retention time extraction
ms1Whether extraction coordinates should be created for MS1 (if false, it will be for MS2)

◆ prepareExtractionCoordinates_()

void prepareExtractionCoordinates_ ( std::vector< OpenSwath::ChromatogramPtr > &  chrom_list,
std::vector< ChromatogramExtractorAlgorithm::ExtractionCoordinates > &  coordinates,
const OpenSwath::LightTargetedExperiment transition_exp_used,
const bool  ms1,
const TransformationDescription  trafo_inverse,
const ChromExtractParams cp 
) const
protected

Function to prepare extraction coordinates that also correctly handles RT transformations.

Creates a set of (empty) chromatograms and extraction coordinates with the correct ids, m/z and retention time start/end points to be extracted by the ChromatogramExtractor.

Handles rt extraction windows by calculating the correct transformation for each coordinate.

Parameters
chrom_listOutput of chromatograms (will be filled with empty chromatogram ptrs)
coordinatesOutput of extraction coordinates (will be filled with matching extraction coordinates)
transition_exp_usedThe transition experiment used to create the coordinates
ms1Whether to perform MS1 (precursor ion) or MS2 (fragment ion) extraction
trafo_inverseInverse transformation function
cpParameter set for the chromatogram extraction

◆ scoreAllChromatograms()

void scoreAllChromatograms ( const OpenSwath::SpectrumAccessPtr  input,
const std::map< std::string, OpenSwath::ChromatogramPtr > &  ms1_chromatograms,
const std::vector< OpenSwath::SwathMap swath_maps,
OpenSwath::LightTargetedExperiment transition_exp,
const Param feature_finder_param,
TransformationDescription  trafo,
const double  rt_extraction_window,
FeatureMap output,
OpenSwathTSVWriter tsv_writer,
OpenSwathOSWWriter osw_writer,
bool  ms1only = false 
)
protected

Perform scoring on a set of chromatograms.

Will iterate over all assays contained in transition_exp and for each assay fetch the corresponding chromatograms and find peak groups.

Parameters
inputInput chromatograms (MS2 level)
ms1_chromatogramsInput chromatograms for MS1-level
swath_mapsSet of swath map(s) for the current swath window (for SONAR multiple maps are provided)
transition_expThe transition experiment (assay library)
feature_finder_paramParameters for the MRMFeatureFinderScoring
trafoRT Transformation function
rt_extraction_windowRT extraction window
outputOutput map
tsv_writerTSV writer for storing output (on the fly)
osw_writerOSW Writer object to store identified features in SQLite format

◆ selectCompoundsForBatch_()

void selectCompoundsForBatch_ ( const OpenSwath::LightTargetedExperiment transition_exp_used_all,
OpenSwath::LightTargetedExperiment transition_exp_used,
int  batch_size,
size_t  j 
)
protected

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

This function will select which compounds to analyze in the next batch j and will copy the corresponding compounds and transitions into the output structure. The output will contain batch_size compounds.

Parameters
transition_exp_used_allinput (all transitions for this swath)
transition_exp_usedoutput (will contain only transitions for the next batch)
batch_sizehow many compounds per batch
jbatch number (peptides from j*batch_size to j*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 to disk.

Member Data Documentation

◆ ms1_map_

OpenSwath::SpectrumAccessPtr ms1_map_
protected

Spectrum Access to the MS1 map (note that this is *not* threadsafe!)

Note
This pointer is not threadsafe, please use the lightClone() function to create a copy for each thread
This pointer may be NULL if use_ms1_traces_ is set to false

◆ use_ms1_traces_

bool use_ms1_traces_
protected

Whether to use the MS1 traces.


OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:11 using doxygen 1.8.13