OpenMS  3.0.0
ChromatogramExtractor.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-2022.
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 #pragma once
36 
38 
42 
45 
46 namespace OpenMS
47 {
48 
67  class OPENMS_DLLAPI ChromatogramExtractor :
68  public ProgressLogger
69  {
70 
71 public:
72 
74 
95  template <typename ExperimentT>
96  void extractChromatograms(const ExperimentT& input,
97  ExperimentT& output,
98  OpenMS::TargetedExperiment& transition_exp,
99  double mz_extraction_window,
100  bool ppm, TransformationDescription trafo,
101  double rt_extraction_window,
102  const String& filter)
103  {
104  // invert the trafo because we want to transform nRT values to "real" RT values
105  trafo.invert();
106 
107  Size input_size = input.size();
108  if (input_size < 1)
109  {
110  return;
111  }
112 
113  int used_filter = getFilterNr_(filter);
114  populatePeptideRTMap_(transition_exp, rt_extraction_window);
115 
116  // sort the transition experiment by product mass
117  // this is essential because the algorithm assumes sorted transitions!
118  transition_exp.sortTransitionsByProductMZ();
119 
120  // prepare all the spectra (but leave them empty)
121  SpectrumSettings settings = input[0];
122  std::vector<typename ExperimentT::ChromatogramType> chromatograms;
123  prepareSpectra_(settings, chromatograms, transition_exp);
124 
125  //go through all spectra
126  startProgress(0, input_size, "Extracting chromatograms");
127  for (Size scan_idx = 0; scan_idx < input_size; ++scan_idx)
128  {
129  setProgress(scan_idx);
130 
131  if (input[scan_idx].size() == 0)
132  continue;
133 
134  Size peak_idx = 0;
135 
136  double mz;
137  double integrated_intensity = 0;
138 
139  // go through all transitions / chromatograms which are sorted by
140  // ProductMZ. We can use this to step through the spectrum and at the
141  // same time step through the transitions. We increase the peak counter
142  // until we hit the next transition and then extract the signal.
143  for (Size k = 0; k < chromatograms.size(); ++k)
144  {
145 
146  double current_rt = input[scan_idx].getRT();
147  if (outsideExtractionWindow_(transition_exp.getTransitions()[k], current_rt, trafo, rt_extraction_window))
148  {
149  continue;
150  }
151 
153  mz = transition_exp.getTransitions()[k].getProductMZ();
154 
155  if (used_filter == 1)
156  {
157  extract_value_tophat(input[scan_idx], mz, peak_idx, integrated_intensity, mz_extraction_window, ppm);
158  }
159  else if (used_filter == 2)
160  {
161  extract_value_bartlett(input[scan_idx], mz, peak_idx, integrated_intensity, mz_extraction_window, ppm);
162  }
163 
164 
165  p.setRT(current_rt);
166  p.setIntensity(integrated_intensity);
167  chromatograms[k].push_back(p);
168  }
169  }
170  endProgress();
171 
172  // add all the chromatograms to the output
173  output.setChromatograms(chromatograms);
174  }
175 
194  std::vector< OpenSwath::ChromatogramPtr >& output,
195  const std::vector<ExtractionCoordinates>& extraction_coordinates,
196  double mz_extraction_window,
197  bool ppm,
198  const String& filter)
199  {
201  extraction_coordinates, mz_extraction_window, ppm, -1, filter);
202  }
203 
223  std::vector< OpenSwath::ChromatogramPtr >& output,
224  const std::vector<ExtractionCoordinates>& extraction_coordinates,
225  double mz_extraction_window,
226  bool ppm,
227  double im_extraction_window,
228  const String& filter)
229  {
231  extraction_coordinates, mz_extraction_window, ppm, im_extraction_window, filter);
232  }
233 
255  static void prepare_coordinates(std::vector< OpenSwath::ChromatogramPtr > & output_chromatograms,
256  std::vector< ExtractionCoordinates > & coordinates,
257  const OpenMS::TargetedExperiment & transition_exp,
258  const double rt_extraction_window,
259  const bool ms1 = false,
260  const int ms1_isotopes = 0);
261 
262  static void prepare_coordinates(std::vector< OpenSwath::ChromatogramPtr > & output_chromatograms,
263  std::vector< ExtractionCoordinates > & coordinates,
264  const OpenSwath::LightTargetedExperiment & transition_exp_used,
265  const double rt_extraction_window,
266  const bool ms1 = false,
267  const int ms1_isotopes = 0);
268 
283  template <typename TransitionExpT>
284  static void return_chromatogram(const std::vector< OpenSwath::ChromatogramPtr > & chromatograms,
285  const std::vector< ChromatogramExtractor::ExtractionCoordinates > & coordinates,
286  TransitionExpT& transition_exp_used,
287  SpectrumSettings settings,
288  std::vector<OpenMS::MSChromatogram > & output_chromatograms,
289  bool ms1,
290  double im_extraction_width = 0.0)
291  {
292  typedef std::map<String, const typename TransitionExpT::Transition* > TransitionMapType;
293  TransitionMapType trans_map;
294  for (Size i = 0; i < transition_exp_used.getTransitions().size(); i++)
295  {
296  trans_map[transition_exp_used.getTransitions()[i].getNativeID()] = &transition_exp_used.getTransitions()[i];
297  }
298 
299  for (Size i = 0; i < chromatograms.size(); i++)
300  {
301  const OpenSwath::ChromatogramPtr & chromptr = chromatograms[i];
302  const ChromatogramExtractor::ExtractionCoordinates & coord = coordinates[i];
303 
304  // copy data
307  chrom.setNativeID(coord.id);
308 
309  // Create precursor and set
310  // 1) the target m/z
311  // 2) the isolation window (upper/lower)
312  // 3) the peptide sequence
313  Precursor prec;
314  if (ms1)
315  {
316  prec.setMZ(coord.mz);
318 
319  // extract compound / peptide id from transition and store in
320  // more-or-less default field
321  String transition_group_id = OpenSwathHelper::computeTransitionGroupId(coord.id);
322  if (!transition_group_id.empty())
323  {
324  int prec_charge = 0;
325  String r = extract_id_(transition_exp_used, transition_group_id, prec_charge);
326  prec.setCharge(prec_charge);
327  prec.setMetaValue("peptide_sequence", r);
328  }
329  }
330  else
331  {
332  typename TransitionExpT::Transition transition = (*trans_map[coord.id]);
333 
334  prec.setMZ(transition.getPrecursorMZ());
335  if (!settings.getPrecursors().empty())
336  {
337  prec.setIsolationWindowLowerOffset(settings.getPrecursors()[0].getIsolationWindowLowerOffset());
338  prec.setIsolationWindowUpperOffset(settings.getPrecursors()[0].getIsolationWindowUpperOffset());
339  }
340 
341  // Create product and set its m/z
342  Product prod;
343  prod.setMZ(transition.getProductMZ());
344  chrom.setProduct(prod);
346 
347  // extract compound / peptide id from transition and store in
348  // more-or-less default field
349  if (!transition.getPeptideRef().empty())
350  {
351  int prec_charge = 0;
352  String r = extract_id_(transition_exp_used, transition.getPeptideRef(), prec_charge);
353  prec.setCharge(prec_charge);
354  prec.setMetaValue("peptide_sequence", r);
355  }
356  else
357  {
358  int prec_charge = 0;
359  String r = extract_id_(transition_exp_used, transition.getCompoundRef(), prec_charge);
360  prec.setCharge(prec_charge);
361  prec.setMetaValue("peptide_sequence", r);
362  }
363  }
364 
365  if (coord.ion_mobility >= 0 && im_extraction_width > 0.0)
366  {
367  prec.setDriftTime(coord.ion_mobility);
368  prec.setDriftTimeWindowLowerOffset(im_extraction_width / 2.0);
369  prec.setDriftTimeWindowUpperOffset(im_extraction_width / 2.0);
370  }
371  chrom.setPrecursor(prec);
372 
373  // Set the rest of the meta-data
375  chrom.setAcquisitionInfo(settings.getAcquisitionInfo());
376  chrom.setSourceFile(settings.getSourceFile());
377 
378  for (Size j = 0; j < settings.getDataProcessing().size(); ++j)
379  {
380  settings.getDataProcessing()[j]->setMetaValue("performed_on_spectra", "true");
381  chrom.getDataProcessing().push_back(settings.getDataProcessing()[j]);
382  }
383  output_chromatograms.push_back(chrom);
384  }
385  }
386 
388  template <typename SpectrumT>
389  void extract_value_tophat(const SpectrumT& input,
390  const double mz,
391  Size& peak_idx,
392  double& integrated_intensity,
393  const double extract_window,
394  const bool ppm)
395  {
396  integrated_intensity = 0;
397  if (input.size() == 0)
398  {
399  return;
400  }
401 
402  // calculate extraction window
403  double left, right;
404  if (ppm)
405  {
406  left = mz - mz * extract_window / 2.0 * 1.0e-6;
407  right = mz + mz * extract_window / 2.0 * 1.0e-6;
408  }
409  else
410  {
411  left = mz - extract_window / 2.0;
412  right = mz + extract_window / 2.0;
413  }
414 
415  Size walker;
416 
417  // advance the peak_idx until we hit the m/z value of the next transition
418  while (peak_idx < input.size() && input[peak_idx].getMZ() < mz)
419  {
420  peak_idx++;
421  }
422 
423  // walk right and left and add to our intensity
424  walker = peak_idx;
425  // if we moved past the end of the spectrum, we need to try the last peak
426  // of the spectrum (it could still be within the window)
427  if (peak_idx >= input.size())
428  {
429  walker = input.size() - 1;
430  }
431 
432  // add the current peak if it is between right and left
433  if (input[walker].getMZ() > left && input[walker].getMZ() < right)
434  {
435  integrated_intensity += input[walker].getIntensity();
436  }
437 
438  // (i) Walk to the left one step and then keep walking left until we go
439  // outside the window. Note for the first step to the left we have to
440  // check for the walker becoming zero.
441  walker = peak_idx;
442  if (walker > 0)
443  {
444  walker--;
445  // special case: walker is now zero
446  if (walker == 0 && input[walker].getMZ() > left && input[walker].getMZ() < right)
447  {
448  integrated_intensity += input[walker].getIntensity();
449  }
450  }
451  while (walker > 0 && input[walker].getMZ() > left && input[walker].getMZ() < right)
452  {
453  integrated_intensity += input[walker].getIntensity(); walker--;
454  }
455 
456  // (ii) Walk to the right one step and then keep walking right until we
457  // are outside the window
458  walker = peak_idx;
459  if (walker < input.size() )
460  {
461  walker++;
462  }
463  while (walker < input.size() && input[walker].getMZ() > left && input[walker].getMZ() < right)
464  {
465  integrated_intensity += input[walker].getIntensity(); walker++;
466  }
467  }
468 
470  template <typename SpectrumT>
471  void extract_value_bartlett(const SpectrumT& input,
472  const double mz,
473  Size& peak_idx,
474  double& integrated_intensity,
475  const double extract_window,
476  const bool ppm)
477  {
478  integrated_intensity = 0;
479  if (input.size() == 0)
480  {
481  return;
482  }
483 
484  // calculate extraction window
485  double left, right, half_window_size, weight;
486  if (ppm)
487  {
488  half_window_size = mz * extract_window / 2.0 * 1.0e-6;
489  left = mz - mz * extract_window / 2.0 * 1.0e-6;
490  right = mz + mz * extract_window / 2.0 * 1.0e-6;
491  }
492  else
493  {
494  half_window_size = extract_window / 2.0;
495  left = mz - extract_window / 2.0;
496  right = mz + extract_window / 2.0;
497  }
498 
499  Size walker;
500 
501  // advance the peak_idx until we hit the m/z value of the next transition
502  while (peak_idx < input.size() && input[peak_idx].getMZ() < mz)
503  {
504  peak_idx++;
505  }
506 
507  // walk right and left and add to our intensity
508  walker = peak_idx;
509  // if we moved past the end of the spectrum, we need to try the last peak
510  // of the spectrum (it could still be within the window)
511  if (peak_idx >= input.size())
512  {
513  walker = input.size() - 1;
514  }
515 
516  // add the current peak if it is between right and left
517  if (input[walker].getMZ() > left && input[walker].getMZ() < right)
518  {
519  weight = 1 - fabs(input[walker].getMZ() - mz) / half_window_size;
520  integrated_intensity += input[walker].getIntensity() * weight;
521  }
522 
523  // (i) Walk to the left one step and then keep walking left until we go
524  // outside the window. Note for the first step to the left we have to
525  // check for the walker becoming zero.
526  walker = peak_idx;
527  if (walker > 0)
528  {
529  walker--;
530  // special case: walker is now zero
531  if (walker == 0 && input[walker].getMZ() > left && input[walker].getMZ() < right)
532  {
533  integrated_intensity += input[walker].getIntensity();
534  }
535  }
536  while (walker > 0 && input[walker].getMZ() > left && input[walker].getMZ() < right)
537  {
538  weight = 1 - fabs(input[walker].getMZ() - mz) / half_window_size;
539  integrated_intensity += input[walker].getIntensity() * weight; walker--;
540  }
541 
542  // (ii) Walk to the right one step and then keep walking right until we
543  // are outside the window
544  walker = peak_idx;
545  if (walker < input.size() )
546  {
547  walker++;
548  }
549  while (walker<input.size() && input[walker].getMZ()> left && input[walker].getMZ() < right)
550  {
551  weight = 1 - fabs(input[walker].getMZ() - mz) / half_window_size;
552  integrated_intensity += input[walker].getIntensity() * weight; walker++;
553  }
554  }
555 
556 private:
565  template <typename TransitionExpT>
566  static String extract_id_(TransitionExpT& transition_exp_used, const String& id, int& prec_charge);
567 
582  template <class SpectrumSettingsT, class ChromatogramT>
583  void prepareSpectra_(SpectrumSettingsT& settings,
584  std::vector<ChromatogramT>& chromatograms,
585  OpenMS::TargetedExperiment& transition_exp)
586  {
587  // first prepare all the spectra (but leave them empty)
588  for (Size i = 0; i < transition_exp.getTransitions().size(); i++)
589  {
590  const ReactionMonitoringTransition* transition = &transition_exp.getTransitions()[i];
591 
592  // 1) and 2) Extract precursor m/z and isolation window
593  ChromatogramT chrom;
594  Precursor prec;
595  prec.setMZ(transition->getPrecursorMZ());
596  if (settings.getPrecursors().size() > 0)
597  {
598  prec.setIsolationWindowLowerOffset(settings.getPrecursors()[0].getIsolationWindowLowerOffset());
599  prec.setIsolationWindowUpperOffset(settings.getPrecursors()[0].getIsolationWindowUpperOffset());
600  }
601 
602  // 3) set precursor peptide sequence / compound id in more-or-less default field
603  String pepref = transition->getPeptideRef();
604  for (Size pep_idx = 0; pep_idx < transition_exp.getPeptides().size(); pep_idx++)
605  {
606  const OpenMS::TargetedExperiment::Peptide* pep = &transition_exp.getPeptides()[pep_idx];
607  if (pep->id == pepref)
608  {
609  prec.setMetaValue("peptide_sequence", pep->sequence);
610  break;
611  }
612  }
613  String compref = transition->getCompoundRef();
614  for (Size comp_idx = 0; comp_idx < transition_exp.getCompounds().size(); comp_idx++)
615  {
616  const OpenMS::TargetedExperiment::Compound* comp = &transition_exp.getCompounds()[comp_idx];
617  if (comp->id == compref)
618  {
619  prec.setMetaValue("peptide_sequence", String(comp->id) );
620  break;
621  }
622  }
623 
624  // add precursor to spectrum
625  chrom.setPrecursor(prec);
626 
627  // 4) Create product and set its m/z
628  Product prod;
629  prod.setMZ(transition->getProductMZ());
630  chrom.setProduct(prod);
631 
632  // 5) Set the rest of the meta-data
633  chrom.setInstrumentSettings(settings.getInstrumentSettings());
634  chrom.setAcquisitionInfo(settings.getAcquisitionInfo());
635  chrom.setSourceFile(settings.getSourceFile());
636 
637  for (Size j = 0; j < settings.getDataProcessing().size(); ++j)
638  {
639  settings.getDataProcessing()[j]->setMetaValue("performed_on_spectra", "true");
640  chrom.getDataProcessing().push_back(settings.getDataProcessing()[j]);
641  }
642 
643  // Set the id of the chromatogram, using the id of the transition (this gives directly the mapping of the two)
644  chrom.setNativeID(transition->getNativeID());
646  chromatograms.push_back(chrom);
647  }
648 
649  }
650 
652  bool outsideExtractionWindow_(const ReactionMonitoringTransition& transition,
653  double current_rt,
654  const TransformationDescription& trafo,
655  double rt_extraction_window);
656 
658  int getFilterNr_(const String& filter);
659 
661  void populatePeptideRTMap_(OpenMS::TargetedExperiment& transition_exp,
662  double rt_extraction_window);
663 
664  std::map<OpenMS::String, double> PeptideRTMap_;
665 
666  };
667 
668  // Specialization for template (LightTargetedExperiment)
669  template<>
670  inline String ChromatogramExtractor::extract_id_<OpenSwath::LightTargetedExperiment>(OpenSwath::LightTargetedExperiment& transition_exp_used,
671  const String& id,
672  int & prec_charge)
673  {
674  const OpenSwath::LightCompound comp = transition_exp_used.getCompoundByRef(id);
675  prec_charge = comp.charge;
676  if (!comp.sequence.empty())
677  {
678  return comp.sequence;
679  }
680  else
681  {
682  return comp.compound_name;
683  }
684  }
685 
686 
687  // Specialization for template (TargetedExperiment)
688  template<>
689  inline String ChromatogramExtractor::extract_id_<OpenMS::TargetedExperiment>(OpenMS::TargetedExperiment& transition_exp_used,
690  const String& id,
691  int & prec_charge)
692  {
693  if (transition_exp_used.hasPeptide(id))
694  {
695  const TargetedExperiment::Peptide p = transition_exp_used.getPeptideByRef(id);
696  if (p.hasCharge()) {prec_charge = p.getChargeState();}
697  return p.sequence;
698  }
699  else if (transition_exp_used.hasCompound(id))
700  {
701  const TargetedExperiment::Compound c = transition_exp_used.getCompoundByRef(id);
702  if (c.hasCharge()) {prec_charge = c.getChargeState();}
703  return c.id;
704  }
705  else
706  {
707  return "";
708  }
709  }
710 }
711 
OpenMS::PeakType
Peak2D PeakType
Definition: MassTrace.h:47
TargetedExperiment.h
OpenMS::Precursor::setDriftTimeWindowUpperOffset
void setDriftTimeWindowUpperOffset(double drift_time)
sets the upper offset from the target ion mobility
OpenMS::ChromatogramExtractorAlgorithm::extractChromatograms
void extractChromatograms(const OpenSwath::SpectrumAccessPtr input, std::vector< OpenSwath::ChromatogramPtr > &output, const std::vector< ExtractionCoordinates > &extraction_coordinates, double mz_extraction_window, bool ppm, double im_extraction_window, const String &filter)
Extract chromatograms at the m/z and RT defined by the ExtractionCoordinates.
OpenMS::TargetedExperiment::getPeptides
const std::vector< Peptide > & getPeptides() const
OpenMS::TargetedExperiment::sortTransitionsByProductMZ
void sortTransitionsByProductMZ()
Lexicographically sorts the transitions by their product m/z.
OpenMS::ReactionMonitoringTransition::getPrecursorMZ
double getPrecursorMZ() const
get the precursor mz (Q1 value)
OpenMS::SpectrumSettings::getSourceFile
const SourceFile & getSourceFile() const
returns a const reference to the source file
OpenMS::ReactionMonitoringTransition::getCompoundRef
const String & getCompoundRef() const
OpenMS::ReactionMonitoringTransition::getProductMZ
double getProductMZ() const
OpenMS::Precursor::setIsolationWindowLowerOffset
void setIsolationWindowLowerOffset(double bound)
sets the lower offset from the target m/z
ChromatogramExtractorAlgorithm.h
OpenMS::ChromatogramSettings::BASEPEAK_CHROMATOGRAM
Definition: ChromatogramSettings.h:72
OpenMS::ChromatogramExtractor::ExtractionCoordinates
ChromatogramExtractorAlgorithm::ExtractionCoordinates ExtractionCoordinates
Definition: ChromatogramExtractor.h:73
OpenMS::TargetedExperimentHelper::Peptide
Represents a peptide (amino acid sequence)
Definition: TargetedExperimentHelper.h:358
OpenMS::ChromatogramExtractorAlgorithm::ExtractionCoordinates
Definition: ChromatogramExtractorAlgorithm.h:64
OpenMS::Peak1D::setMZ
void setMZ(CoordinateType mz)
Mutable access to m/z.
Definition: Peak1D.h:119
OpenMS::Constants::k
const double k
Definition: Constants.h:153
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::ChromatogramExtractor::extract_value_bartlett
void extract_value_bartlett(const SpectrumT &input, const double mz, Size &peak_idx, double &integrated_intensity, const double extract_window, const bool ppm)
Definition: ChromatogramExtractor.h:471
OpenMS::ChromatogramSettings::setNativeID
void setNativeID(const String &native_id)
sets the native identifier for the spectrum, used by the acquisition software.
OpenMS::SpectrumSettings::getPrecursors
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
OpenMS::ChromatogramSettings::setChromatogramType
void setChromatogramType(ChromatogramType type)
sets the chromatogram type
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
OpenMS::Constants::c
const double c
Definition: Constants.h:209
OpenMS::Product::setMZ
void setMZ(double mz)
sets the target m/z
OpenMS::ChromatogramExtractorAlgorithm
The ChromatogramExtractorAlgorithm extracts chromatograms from a MS data.
Definition: ChromatogramExtractorAlgorithm.h:58
OpenMS::ChromatogramExtractorAlgorithm::ExtractionCoordinates::mz
double mz
m/z value around which should be extracted
Definition: ChromatogramExtractorAlgorithm.h:66
TransformationDescription.h
OpenSwath::LightTargetedExperiment
Definition: TransitionExperiment.h:218
OpenMS::TransformationDescription::invert
void invert()
Computes an (approximate) inverse of the transformation.
OpenMS::ChromatogramSettings::getDataProcessing
std::vector< DataProcessingPtr > & getDataProcessing()
returns a mutable reference to the description of the applied processing
OpenMS::OpenSwathHelper::computeTransitionGroupId
static String computeTransitionGroupId(const String &precursor_id)
Compute transition group id.
Definition: OpenSwathHelper.h:81
OpenSwathHelper.h
OpenMS::SpectrumSettings::getInstrumentSettings
const InstrumentSettings & getInstrumentSettings() const
returns a const reference to the instrument settings of the current spectrum
OpenMS::Precursor
Precursor meta information.
Definition: Precursor.h:58
OpenMS::TargetedExperiment::hasPeptide
bool hasPeptide(const String &ref) const
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::ChromatogramExtractor::prepareSpectra_
void prepareSpectra_(SpectrumSettingsT &settings, std::vector< ChromatogramT > &chromatograms, OpenMS::TargetedExperiment &transition_exp)
This populates the chromatograms vector with empty chromatograms (but sets their meta-information)
Definition: ChromatogramExtractor.h:583
OpenSwath::LightCompound
Definition: TransitionExperiment.h:160
OpenMS::TargetedExperiment::getCompoundByRef
const Compound & getCompoundByRef(const String &ref) const
OpenMS::TargetedExperimentHelper::Peptide::sequence
String sequence
Definition: TargetedExperimentHelper.h:420
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
OpenMS::MetaInfoInterface::setMetaValue
void setMetaValue(const String &name, const DataValue &value)
Sets the DataValue corresponding to a name.
OpenMS::SpectrumSettings::getDataProcessing
std::vector< DataProcessingPtr > & getDataProcessing()
returns a mutable reference to the description of the applied processing
OpenMS::ChromatogramSettings::setProduct
void setProduct(const Product &product)
sets the products
OpenMS::ReactionMonitoringTransition
This class stores a SRM/MRM transition.
Definition: ReactionMonitoringTransition.h:56
OpenMS::ChromatogramExtractor::return_chromatogram
static void return_chromatogram(const std::vector< OpenSwath::ChromatogramPtr > &chromatograms, const std::vector< ChromatogramExtractor::ExtractionCoordinates > &coordinates, TransitionExpT &transition_exp_used, SpectrumSettings settings, std::vector< OpenMS::MSChromatogram > &output_chromatograms, bool ms1, double im_extraction_width=0.0)
This converts the ChromatogramPtr to MSChromatogram and adds meta-information.
Definition: ChromatogramExtractor.h:284
OpenMS::TargetedExperimentHelper::PeptideCompound::hasCharge
bool hasCharge() const
Whether peptide or compound has set charge state.
Definition: TargetedExperimentHelper.h:237
OpenMS::TargetedExperimentHelper::Compound
Represents a compound (small molecule)
Definition: TargetedExperimentHelper.h:321
OpenMS::ChromatogramSettings::SELECTED_REACTION_MONITORING_CHROMATOGRAM
Definition: ChromatogramSettings.h:74
OpenMS::ChromatogramExtractorAlgorithm::ExtractionCoordinates::ion_mobility
double ion_mobility
ion mobility value around which should be extracted
Definition: ChromatogramExtractorAlgorithm.h:67
OpenMS::OpenSwathDataAccessHelper::convertToOpenMSChromatogram
static void convertToOpenMSChromatogram(const OpenSwath::ChromatogramPtr cptr, OpenMS::MSChromatogram &chromatogram)
Convert a ChromatogramPtr to an OpenMS Chromatogram.
OpenSwath::LightTargetedExperiment::getCompoundByRef
const LightCompound & getCompoundByRef(const std::string &ref)
Definition: TransitionExperiment.h:266
OpenMS::ChromatogramExtractor::extractChromatograms
void extractChromatograms(const OpenSwath::SpectrumAccessPtr input, std::vector< OpenSwath::ChromatogramPtr > &output, const std::vector< ExtractionCoordinates > &extraction_coordinates, double mz_extraction_window, bool ppm, double im_extraction_window, const String &filter)
Extract chromatograms at the m/z and RT defined by the ExtractionCoordinates.
Definition: ChromatogramExtractor.h:222
MSExperiment.h
OpenMS::SpectrumSettings::getAcquisitionInfo
const AcquisitionInfo & getAcquisitionInfo() const
returns a const reference to the acquisition info
DataAccessHelper.h
OpenMS::TargetedExperiment::getCompounds
const std::vector< Compound > & getCompounds() const
OpenMS::Precursor::setIsolationWindowUpperOffset
void setIsolationWindowUpperOffset(double bound)
sets the upper offset from the target m/z
OpenMS::ChromatogramExtractor::PeptideRTMap_
std::map< OpenMS::String, double > PeptideRTMap_
Definition: ChromatogramExtractor.h:664
OpenSwath::SpectrumAccessPtr
boost::shared_ptr< ISpectrumAccess > SpectrumAccessPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:87
OpenMS::Precursor::setDriftTime
void setDriftTime(double drift_time)
sets the ion mobility drift time in milliseconds
OpenMS::ChromatogramExtractor::extractChromatograms
void extractChromatograms(const OpenSwath::SpectrumAccessPtr input, std::vector< OpenSwath::ChromatogramPtr > &output, const std::vector< ExtractionCoordinates > &extraction_coordinates, double mz_extraction_window, bool ppm, const String &filter)
Extract chromatograms at the m/z and RT defined by the ExtractionCoordinates.
Definition: ChromatogramExtractor.h:193
OpenMS::ChromatogramSettings::setInstrumentSettings
void setInstrumentSettings(const InstrumentSettings &instrument_settings)
sets the instrument settings of the current spectrum
OpenMS::TargetedExperiment::hasCompound
bool hasCompound(const String &ref) const
OpenMS::TargetedExperiment::getPeptideByRef
const Peptide & getPeptideByRef(const String &ref) const
OpenMS::ChromatogramSettings::setAcquisitionInfo
void setAcquisitionInfo(const AcquisitionInfo &acquisition_info)
sets the acquisition info
OpenMS::MSChromatogram
The representation of a chromatogram.
Definition: MSChromatogram.h:53
OpenMS::TargetedExperiment::getTransitions
const std::vector< ReactionMonitoringTransition > & getTransitions() const
returns the transition list
OpenSwath::LightCompound::sequence
std::string sequence
Definition: TransitionExperiment.h:172
OpenMS::ChromatogramSettings::setPrecursor
void setPrecursor(const Precursor &precursor)
sets the precursors
OpenMS::SpectrumSettings
Representation of 1D spectrum settings.
Definition: SpectrumSettings.h:63
OpenSwath::LightCompound::charge
int charge
Definition: TransitionExperiment.h:171
OpenSwath::ChromatogramPtr
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:172
OpenMS::Product
Product meta information.
Definition: Product.h:48
OpenMS::ChromatogramSettings::setSourceFile
void setSourceFile(const SourceFile &source_file)
sets the source file
OpenMS::Precursor::setDriftTimeWindowLowerOffset
void setDriftTimeWindowLowerOffset(double drift_time)
sets the lower offset from the target ion mobility
OpenMS::Precursor::setCharge
void setCharge(Int charge)
Mutable access to the charge.
OpenMS::TargetedExperiment
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:64
OpenMS::TargetedExperimentHelper::PeptideCompound::getChargeState
int getChargeState() const
Return the peptide or compound charge state.
Definition: TargetedExperimentHelper.h:243
OpenSwath::LightCompound::compound_name
std::string compound_name
Definition: TransitionExperiment.h:181
OpenMS::ReactionMonitoringTransition::getPeptideRef
const String & getPeptideRef() const
OpenMS::ReactionMonitoringTransition::getNativeID
const String & getNativeID() const
OpenMS::ChromatogramExtractor
The ChromatogramExtractor extracts chromatograms from a spectra file.
Definition: ChromatogramExtractor.h:67
OpenMS::ChromatogramExtractor::extractChromatograms
void extractChromatograms(const ExperimentT &input, ExperimentT &output, OpenMS::TargetedExperiment &transition_exp, double mz_extraction_window, bool ppm, TransformationDescription trafo, double rt_extraction_window, const String &filter)
Extract chromatograms defined by the TargetedExperiment from the input map and write them to the outp...
Definition: ChromatogramExtractor.h:96
OpenMS::ChromatogramExtractor::extract_value_tophat
void extract_value_tophat(const SpectrumT &input, const double mz, Size &peak_idx, double &integrated_intensity, const double extract_window, const bool ppm)
Definition: ChromatogramExtractor.h:389
OpenMS::TransformationDescription
Generic description of a coordinate transformation.
Definition: TransformationDescription.h:62
OpenMS::TargetedExperimentHelper::PeptideCompound::id
String id
Definition: TargetedExperimentHelper.h:306
OpenMS::ChromatogramExtractorAlgorithm::ExtractionCoordinates::id
std::string id
identifier
Definition: ChromatogramExtractorAlgorithm.h:71