OpenMS
Loading...
Searching...
No Matches
OpenSwathWorkflow.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Hannes Roest $
6// $Authors: Hannes Roest $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11// Interfaces
12
17
18// Kernel and implementations
24
25// Helpers
27// #include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/DataAccessHelper.h>
30
31// Algorithms
38#include <cassert>
39#include <limits>
40
41// #define OPENSWATH_WORKFLOW_DEBUG
42
43// The workflow class
44namespace OpenMS
45{
46
70
71 class OPENMS_DLLAPI OpenSwathWorkflowBase :
72 public ProgressLogger
73 {
74
75protected:
76
83 use_ms1_traces_(false),
84 use_ms1_ion_mobility_(false),
85 prm_(false),
86 pasef_(false),
87 mrm_(false),
88 threads_outer_loop_(-1)
89 {
90 }
91
108 OpenSwathWorkflowBase(bool use_ms1_traces, bool use_ms1_ion_mobility, bool prm, bool pasef, bool mrm, int threads_outer_loop) :
109 use_ms1_traces_(use_ms1_traces),
110 use_ms1_ion_mobility_(use_ms1_ion_mobility),
111 prm_(prm),
112 pasef_(pasef),
113 mrm_(mrm),
114 threads_outer_loop_(threads_outer_loop)
115 {
116 }
117
131 const std::vector<OpenSwath::SwathMap>& swath_maps,
132 std::vector<MSChromatogram>& ms1_chromatograms,
133 const ChromExtractParams& cp,
134 const OpenSwath::LightTargetedExperiment& transition_exp,
135 const TransformationDescription& trafo_inverse,
136 bool ms1_only = false,
137 int ms1_isotopes = 0);
138
157 void prepareExtractionCoordinates_(std::vector< OpenSwath::ChromatogramPtr > & chrom_list,
158 std::vector< ChromatogramExtractorAlgorithm::ExtractionCoordinates > & coordinates,
159 const OpenSwath::LightTargetedExperiment & transition_exp_used,
160 const TransformationDescription& trafo_inverse,
161 const ChromExtractParams & cp,
162 const bool ms1 = false,
163 const int ms1_isotopes = -1) const;
164
165
174
177
180
189 bool prm_;
190
199 bool pasef_;
200
206 bool mrm_;
207
218
219};
220
249 class OPENMS_DLLAPI OpenSwathWorkflow :
251 {
254
255 public:
256
273 OpenSwathWorkflow(bool use_ms1_traces, bool use_ms1_ion_mobility, bool prm, bool pasef, bool mrm, int threads_outer_loop) :
274 OpenSwathWorkflowBase(use_ms1_traces, use_ms1_ion_mobility, prm, pasef, mrm, threads_outer_loop)
275 {
276 }
277
289 OpenSwath::SpectrumAccessPtr loadMS1Map(const std::vector<OpenSwath::SwathMap>& swath_maps, bool load_into_memory);
290
316 void performExtraction(const std::vector<OpenSwath::SwathMap>& swath_maps,
317 const TransformationDescription& rt_trafo,
318 const ChromExtractParams & chromatogram_extraction_params,
319 const ChromExtractParams & ms1_chromatogram_extraction_params,
320 const Param & feature_finder_param,
321 const OpenSwath::LightTargetedExperiment& assay_library,
322 FeatureMap& result_featureFile,
323 bool store_features_in_featureFile,
324 OpenSwathOSWWriter & result_osw,
325 Interfaces::IMSDataConsumer * result_chromatograms,
326 int batchSize,
327 int ms1_isotopes,
328 bool load_into_memory,
329 const Param & mrm_mapping_param = Param());
330
331 protected:
332
333
349 void writeOutFeaturesAndChroms_(std::vector< OpenMS::MSChromatogram > & chromatograms,
350 std::vector< MSChromatogram >& ms1_chromatograms,
351 const FeatureMap & featureFile,
352 FeatureMap& out_featureFile,
353 bool store_features,
354 Interfaces::IMSDataConsumer * chromConsumer);
355
393 const std::vector<OpenMS::MSChromatogram>& ms2_chromatograms,
394 const std::vector<OpenMS::MSChromatogram>& ms1_chromatograms,
395 const std::vector<OpenSwath::SwathMap>& swath_maps,
396 const OpenSwath::LightTargetedExperiment& transition_exp,
397 const Param& feature_finder_param,
398 const TransformationDescription& trafo,
399 const double rt_extraction_window,
400 FeatureMap& output,
401 OpenSwathOSWWriter& osw_writer,
402 int nr_ms1_isotopes = 0,
403 bool ms1only = false) const;
404
421 OpenSwath::LightTargetedExperiment& transition_exp_used, int batch_size, size_t batch_idx);
422
433 void copyBatchTransitions_(const std::vector<OpenSwath::LightCompound>& used_compounds,
434 const std::vector<OpenSwath::LightTransition>& all_transitions,
435 std::vector<OpenSwath::LightTransition>& output);
436 };
437}
438
439
A container for features.
Definition FeatureMap.h:82
The interface of a consumer of spectra and chromatograms.
Definition IMSDataConsumer.h:46
The representation of a group of transitions in a targeted proteomics experiment.
Definition MRMTransitionGroup.h:42
Class to write out an OpenSwath OSW SQLite output (PyProphet input).
Definition OpenSwathOSWWriter.h:90
Definition OpenSwathWorkflow.h:73
void MS1Extraction_(const OpenSwath::SpectrumAccessPtr &ms1_map, const std::vector< OpenSwath::SwathMap > &swath_maps, std::vector< MSChromatogram > &ms1_chromatograms, const ChromExtractParams &cp, const OpenSwath::LightTargetedExperiment &transition_exp, const TransformationDescription &trafo_inverse, bool ms1_only=false, int ms1_isotopes=0)
Perform MS1 extraction and store result in ms1_chromatograms.
bool prm_
Whether data is acquired in targeted DIA (e.g. PRM mode) with potentially overlapping windows.
Definition OpenSwathWorkflow.h:189
bool use_ms1_traces_
Whether to use the MS1 traces.
Definition OpenSwathWorkflow.h:176
int threads_outer_loop_
How many threads should be used for the outer loop.
Definition OpenSwathWorkflow.h:217
OpenSwathWorkflowBase(bool use_ms1_traces, bool use_ms1_ion_mobility, bool prm, bool pasef, bool mrm, int threads_outer_loop)
Constructor.
Definition OpenSwathWorkflow.h:108
OpenSwathWorkflowBase()
Default constructor.
Definition OpenSwathWorkflow.h:82
bool use_ms1_ion_mobility_
Whether to use ion mobility extraction on MS1 traces.
Definition OpenSwathWorkflow.h:179
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.
bool mrm_
Whether data is chromatogram-only SRM/MRM data.
Definition OpenSwathWorkflow.h:206
bool pasef_
Whether data is diaPASEF data.
Definition OpenSwathWorkflow.h:199
Execute all steps in an OpenSwath analysis.
Definition OpenSwathWorkflow.h:251
MRMTransitionGroup< MSChromatogram, TransitionType > MRMTransitionGroupType
Definition OpenSwathWorkflow.h:253
void writeOutFeaturesAndChroms_(std::vector< OpenMS::MSChromatogram > &chromatograms, std::vector< MSChromatogram > &ms1_chromatograms, const FeatureMap &featureFile, FeatureMap &out_featureFile, bool store_features, Interfaces::IMSDataConsumer *chromConsumer)
Write output features and chromatograms.
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)
OpenSwath::LightTransition TransitionType
Definition OpenSwathWorkflow.h:252
void performExtraction(const std::vector< OpenSwath::SwathMap > &swath_maps, const TransformationDescription &rt_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, OpenSwathOSWWriter &result_osw, Interfaces::IMSDataConsumer *result_chromatograms, int batchSize, int ms1_isotopes, bool load_into_memory, const Param &mrm_mapping_param=Param())
Execute OpenSWATH analysis on a set of SwathMaps and transitions.
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, const TransformationDescription &trafo, const double rt_extraction_window, FeatureMap &output, OpenSwathOSWWriter &osw_writer, int nr_ms1_isotopes=0, bool ms1only=false) const
Perform scoring on a set of chromatograms.
OpenSwath::SpectrumAccessPtr loadMS1Map(const std::vector< OpenSwath::SwathMap > &swath_maps, bool load_into_memory)
Load MS1 SpectrumAccessPtr from given swath maps.
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_()
OpenSwathWorkflow(bool use_ms1_traces, bool use_ms1_ion_mobility, bool prm, bool pasef, bool mrm, int threads_outer_loop)
Constructor.
Definition OpenSwathWorkflow.h:273
Management and storage of parameters / INI files.
Definition Param.h:46
Base class for all classes that want to report their progress.
Definition ProgressLogger.h:27
A more convenient string class.
Definition String.h:34
Generic description of a coordinate transformation.
Definition TransformationDescription.h:37
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
double im_extraction_window
Extraction window in ion mobility.
Definition OpenSwathWorkflow.h:60
bool ppm
Whether the extraction window is given in ppm or Da.
Definition OpenSwathWorkflow.h:62
String extraction_function
The extraction function in mass space.
Definition OpenSwathWorkflow.h:64
double extra_rt_extract
Whether to extract some extra in the retention time (can be useful if one wants to look at the chroma...
Definition OpenSwathWorkflow.h:68
double min_upper_edge_dist
Whether to not extract anything closer than this (in Da) from the upper edge.
Definition OpenSwathWorkflow.h:56
double mz_extraction_window
Extraction window in Da or ppm (e.g. 50ppm means extraction +/- 25ppm)
Definition OpenSwathWorkflow.h:58
double rt_extraction_window
The retention time extraction window.
Definition OpenSwathWorkflow.h:66
ChromatogramExtractor parameters.
Definition OpenSwathWorkflow.h:54
std::shared_ptr< ISpectrumAccess > SpectrumAccessPtr
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:131
Definition TransitionExperiment.h:356
Definition TransitionExperiment.h:105