Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
OpenSwathWorkflow.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Hannes Roest $
32 // $Authors: Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_OPENSWATH_OPENSWATHWORKFLOW_H
36 #define OPENMS_ANALYSIS_OPENSWATH_OPENSWATHWORKFLOW_H
37 
38 // Interfaces
43 
44 #include <OpenMS/FORMAT/MzMLFile.h> // debug file store only
45 
46 // Kernel and implementations
52 
53 // Helpers
55 // #include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/DataAccessHelper.h>
59 
60 // Algorithms
67 
68 #include <assert.h>
69 #include <limits>
70 
71 // #define OPENSWATH_WORKFLOW_DEBUG
72 
73 // The workflow class
74 namespace OpenMS
75 {
76 
84  {
90  bool ppm;
97  };
98 
103  public ProgressLogger
104  {
105  public:
106 
125  TransformationDescription performRTNormalization(const OpenMS::TargetedExperiment & irt_transitions,
126  std::vector< OpenSwath::SwathMap > & swath_maps,
127  double min_rsq,
128  double min_coverage,
129  const Param & feature_finder_param,
130  const ChromExtractParams & cp_irt,
131  const Param & irt_detection_param,
132  const String & mz_correction_function,
133  Size debug_level,
134  bool sonar = false);
135  /*
136  */
137 
138  private:
139 
155  TransformationDescription RTNormalization(const TargetedExperiment& transition_exp_,
156  const std::vector< OpenMS::MSChromatogram >& chromatograms,
157  double min_rsq,
158  double min_coverage,
159  const Param& default_ffparam,
160  const Param& irt_detection_param,
161  std::vector< OpenSwath::SwathMap > & swath_maps,
162  const String & mz_correction_function,
163  double mz_extraction_window,
164  bool ppm);
165 
167  void simpleExtractChromatograms(const std::vector< OpenSwath::SwathMap > & swath_maps,
168  const OpenMS::TargetedExperiment & irt_transitions,
169  std::vector< OpenMS::MSChromatogram > & chromatograms,
170  const ChromExtractParams & cp, bool sonar);
171 
172  static void addChromatograms(MSChromatogram& base_chrom, const MSChromatogram& newchrom);
173  };
174 
183  class OPENMS_DLLAPI OpenSwathWorkflow :
184  public ProgressLogger
185  {
188 
189  public:
190 
191  explicit OpenSwathWorkflow(bool use_ms1_traces) :
192  use_ms1_traces_(use_ms1_traces)
193  {
194  }
195 
219  void performExtraction(const std::vector< OpenSwath::SwathMap > & swath_maps,
220  const TransformationDescription trafo,
221  const ChromExtractParams & cp,
222  const Param & feature_finder_param,
223  const OpenSwath::LightTargetedExperiment& transition_exp,
224  FeatureMap& out_featureFile,
225  bool store_features,
226  OpenSwathTSVWriter & tsv_writer,
227  OpenSwathOSWWriter & osw_writer,
228  Interfaces::IMSDataConsumer * chromConsumer,
229  int batchSize,
230  bool load_into_memory);
231 
232  protected:
233 
234 
238  void writeOutFeaturesAndChroms_(std::vector< OpenMS::MSChromatogram > & chromatograms,
239  const FeatureMap & featureFile,
240  FeatureMap& out_featureFile,
241  bool store_features,
242  Interfaces::IMSDataConsumer * chromConsumer);
243 
247  void MS1Extraction_(const std::vector< OpenSwath::SwathMap > & swath_maps,
248  std::map< std::string, OpenSwath::ChromatogramPtr >& ms1_chromatograms,
249  Interfaces::IMSDataConsumer * chromConsumer,
250  const ChromExtractParams & cp,
251  const OpenSwath::LightTargetedExperiment& transition_exp,
252  const TransformationDescription& trafo_inverse,
253  bool load_into_memory,
254  bool ms1only = false);
255 
273  void scoreAllChromatograms(
274  const OpenSwath::SpectrumAccessPtr input,
275  const std::map< std::string, OpenSwath::ChromatogramPtr > & ms1_chromatograms,
276  const std::vector< OpenSwath::SwathMap > swath_maps,
277  OpenSwath::LightTargetedExperiment& transition_exp,
278  const Param& feature_finder_param,
280  const double rt_extraction_window,
281  FeatureMap& output,
282  OpenSwathTSVWriter & tsv_writer,
283  OpenSwathOSWWriter & osw_writer,
284  bool ms1only = false);
285 
300  void selectCompoundsForBatch_(const OpenSwath::LightTargetedExperiment& transition_exp_used_all,
301  OpenSwath::LightTargetedExperiment& transition_exp_used, int batch_size, size_t j);
302 
313  void copyBatchTransitions_(const std::vector<OpenSwath::LightCompound>& used_compounds,
314  const std::vector<OpenSwath::LightTransition>& all_transitions,
315  std::vector<OpenSwath::LightTransition>& output);
316 
334  void prepareExtractionCoordinates_(std::vector< OpenSwath::ChromatogramPtr > & chrom_list,
335  std::vector< ChromatogramExtractorAlgorithm::ExtractionCoordinates > & coordinates,
336  const OpenSwath::LightTargetedExperiment & transition_exp_used,
337  const bool ms1, const TransformationDescription trafo_inverse,
338  const ChromExtractParams & cp) const;
339 
353  void prepare_coordinates_sub(std::vector< OpenSwath::ChromatogramPtr > & output_chromatograms,
354  std::vector< ChromatogramExtractorAlgorithm::ExtractionCoordinates > & coordinates,
355  const OpenSwath::LightTargetedExperiment & transition_exp_used,
356  const double rt_extraction_window, const bool ms1) const;
357 
366 
369 
370  };
371 
381  class OPENMS_DLLAPI OpenSwathWorkflowSonar :
382  public OpenSwathWorkflow
383  {
384 
385  public:
386  explicit OpenSwathWorkflowSonar(bool use_ms1_traces) :
387  OpenSwathWorkflow(use_ms1_traces)
388  {}
389 
416  void performExtractionSonar(const std::vector< OpenSwath::SwathMap > & swath_maps,
417  const TransformationDescription trafo,
418  const ChromExtractParams & cp,
419  const Param & feature_finder_param,
420  const OpenSwath::LightTargetedExperiment& transition_exp,
421  FeatureMap& out_featureFile,
422  bool store_features,
423  OpenSwathTSVWriter & tsv_writer,
424  OpenSwathOSWWriter & osw_writer,
425  Interfaces::IMSDataConsumer * chromConsumer,
426  int batchSize,
427  bool load_into_memory);
428 
432  void computeSonarWindows_(const std::vector< OpenSwath::SwathMap > & swath_maps,
433  double & sonar_winsize,
434  double & sonar_start,
435  double & sonar_end,
436  int & sonar_total_win);
437 
441  void performSonarExtraction_(const std::vector< OpenSwath::SwathMap > & used_maps,
442  const std::vector< ChromatogramExtractor::ExtractionCoordinates > & coordinates,
443  std::vector< OpenSwath::ChromatogramPtr > & chrom_list,
444  const ChromExtractParams & cp);
445 
453  };
454 
455 }
456 
457 #endif // OPENMS_ANALYSIS_OPENSWATH_OPENSWATHWORKFLOW_H
458 
A more convenient string class.
Definition: String.h:57
OpenSwathWorkflow(bool use_ms1_traces)
Definition: OpenSwathWorkflow.h:191
double mz_extraction_window
Extraction window in Da or ppm (e.g. 50ppm means extraction +/- 25ppm)
Definition: OpenSwathWorkflow.h:88
ChromatogramExtractor parameters.
Definition: OpenSwathWorkflow.h:83
OpenSwathWorkflowSonar(bool use_ms1_traces)
Definition: OpenSwathWorkflow.h:386
boost::shared_ptr< ISpectrumAccess > SpectrumAccessPtr
Definition: openswathalgo/include/OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:90
The representation of a chromatogram.
Definition: MSChromatogram.h:55
A container for features.
Definition: FeatureMap.h:94
bool use_ms1_traces_
Whether to use the MS1 traces.
Definition: OpenSwathWorkflow.h:368
bool ppm
Whether the extraction window is given in ppm or Da.
Definition: OpenSwathWorkflow.h:90
Class to write out an OpenSwath TSV output (mProphet input)
Definition: OpenSwathTSVWriter.h:57
MRMTransitionGroup< MSChromatogram, TransitionType > MRMTransitionGroupType
Definition: OpenSwathWorkflow.h:187
Class to execute an OpenSwath Workflow.
Definition: OpenSwathWorkflow.h:183
Class to execute an OpenSwath Workflow for SONAR data.
Definition: OpenSwathWorkflow.h:381
OpenSwath::LightTransition TransitionType
Definition: OpenSwathWorkflow.h:186
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Class to write out an OpenSwath OSW SQLite output (PyProphet input)
Definition: OpenSwathOSWWriter.h:57
The representation of a group of transitions in a targeted proteomics experiment. ...
Definition: MRMTransitionGroup.h:68
double rt_extraction_window
The retention time extraction window.
Definition: OpenSwathWorkflow.h:94
double min_upper_edge_dist
Whether to not extract anything closer than this (in Da) from the upper edge.
Definition: OpenSwathWorkflow.h:86
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openswathalgo/include/OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/DATAACCESS/DataStructures.h:156
String extraction_function
The extraction function in mass space.
Definition: OpenSwathWorkflow.h:92
Management and storage of parameters / INI files.
Definition: Param.h:75
Definition: TransitionExperiment.h:47
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
Simple OpenSwathWorkflow to perform RT and m/z correction based on a set of known peptides...
Definition: OpenSwathWorkflow.h:102
The interface of a consumer of spectra and chromatograms.
Definition: IMSDataConsumer.h:68
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:62
Generic description of a coordinate transformation.
Definition: TransformationDescription.h:61
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:96
OpenSwath::SpectrumAccessPtr ms1_map_
Spectrum Access to the MS1 map (note that this is *not* threadsafe!)
Definition: OpenSwathWorkflow.h:365
Definition: TransitionExperiment.h:195

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