OpenMS
DIAHelper.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Hannes Roest $
6 // $Authors: Witold Wolski, Hannes Roest $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 
14 #include <vector>
15 
16 namespace OpenMS
17 {
18  class TheoreticalSpectrumGenerator;
19  namespace DIAHelpers
20  {
21 
26 
38  OPENMS_DLLAPI bool integrateWindow(const OpenSwath::SpectrumPtr& spectrum, double mz_start,
39  double mz_end, double& mz, double& intensity, bool centroided = false);
40 
44  OPENMS_DLLAPI void integrateWindows(const OpenSwath::SpectrumPtr& spectrum,
45  const std::vector<double>& windows_center,
46  double width,
47  std::vector<double>& integrated_windows_intensity,
48  std::vector<double>& integrated_windows_mz,
49  bool remove_zero = false);
50 
60  OPENMS_DLLAPI void integrateDriftSpectrum(const OpenSwath::SpectrumPtr& spectrum,
61  double mz_start,
62  double mz_end,
63  double & im,
64  double & intensity,
65  double drift_start,
66  double drift_end);
67 
71  OPENMS_DLLAPI void adjustExtractionWindow(double& right, double& left, const double& mz_extract_window, const bool& mz_extraction_ppm);
72 
74  OPENMS_DLLAPI void getBYSeries(const AASequence& a,
75  std::vector<double>& bseries,
76  std::vector<double>& yseries,
78  int charge = 1);
79 
81  OPENMS_DLLAPI void getTheorMasses(const AASequence& a,
82  std::vector<double>& masses,
84  int charge = 1);
85 
87  OPENMS_DLLAPI void getAveragineIsotopeDistribution(const double product_mz,
88  std::vector<std::pair<double, double> >& isotopes_spec,
89  const int charge = 1,
90  const int nr_isotopes = 4,
91  const double mannmass = 1.00048);
92 
94  OPENMS_DLLAPI void simulateSpectrumFromAASequence(const AASequence& aa,
95  std::vector<double>& first_isotope_masses, //[out]
96  std::vector<std::pair<double, double> >& isotope_masses, //[out]
98  int charge = 1);
99 
101  OPENMS_DLLAPI void modifyMassesByCharge(const std::vector<std::pair<double, double> >& masses,
102  std::vector<std::pair<double, double> >& modmass,
103  int charge = 1);
104 
106  OPENMS_DLLAPI void addPreisotopeWeights(const std::vector<double>& first_isotope_masses,
107  std::vector<std::pair<double, double> >& isotope_spec, // output
108  UInt nr_peaks = 2, //nr of pre-isotope peaks
109  double pre_isotope_peaks_weight = -0.5, // weight of pre-isotope peaks
110  double mannmass = 1.000482, //
111  int charge = 1);
112 
114  OPENMS_DLLAPI void addPreisotopeWeights(double mz,
115  std::vector<std::pair<double, double> >& isotope_spec, // output
116  UInt nr_peaks = 2, //nr of pre-isotope peaks
117  double pre_isotope_peaks_weight = -0.5, // weight of pre-isotope peaks
118  double mannmass = 1.000482, //
119  int charge = 1);
120 
123  OPENMS_DLLAPI void addIsotopes2Spec(const std::vector<std::pair<double, double> >& spec,
124  std::vector<std::pair<double, double> >& isotope_masses, //[out]
125  Size nr_isotopes, int charge = 1);
126 
129  OPENMS_DLLAPI void addSinglePeakIsotopes2Spec(double mz, double ity,
130  std::vector<std::pair<double, double> >& isotope_masses, //[out]
131  Size nr_isotopes, int charge);
132 
134  OPENMS_DLLAPI void sortByFirst(std::vector<std::pair<double, double> >& tmp);
136  OPENMS_DLLAPI void extractFirst(const std::vector<std::pair<double, double> >& peaks, std::vector<double>& mass);
138  OPENMS_DLLAPI void extractSecond(const std::vector<std::pair<double, double> >& peaks, std::vector<double>& mass);
139 
141  }
142 }
143 
Representation of a peptide/protein sequence.
Definition: AASequence.h:86
Generates theoretical spectra for peptides with various options.
Definition: TheoreticalSpectrumGenerator.h:44
unsigned int UInt
Unsigned integer type.
Definition: Types.h:68
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
void modifyMassesByCharge(const std::vector< std::pair< double, double > > &masses, std::vector< std::pair< double, double > > &modmass, int charge=1)
modify masses by charge
void extractSecond(const std::vector< std::pair< double, double > > &peaks, std::vector< double > &mass)
extract second from vector of pairs
void integrateWindows(const OpenSwath::SpectrumPtr &spectrum, const std::vector< double > &windows_center, double width, std::vector< double > &integrated_windows_intensity, std::vector< double > &integrated_windows_mz, bool remove_zero=false)
Integrate intensities in a spectrum from start to end.
void addPreisotopeWeights(const std::vector< double > &first_isotope_masses, std::vector< std::pair< double, double > > &isotope_spec, UInt nr_peaks=2, double pre_isotope_peaks_weight=-0.5, double mannmass=1.000482, int charge=1)
add (potentially negative) pre-isotope weights to spectrum
void sortByFirst(std::vector< std::pair< double, double > > &tmp)
sorts vector of pairs by first
bool integrateWindow(const OpenSwath::SpectrumPtr &spectrum, double mz_start, double mz_end, double &mz, double &intensity, bool centroided=false)
Helper functions for the DIA scoring of OpenSWATH.
void getTheorMasses(const AASequence &a, std::vector< double > &masses, TheoreticalSpectrumGenerator const *g, int charge=1)
for SWATH – get the theoretical b and y series masses for a sequence
void getBYSeries(const AASequence &a, std::vector< double > &bseries, std::vector< double > &yseries, TheoreticalSpectrumGenerator const *g, int charge=1)
compute the b and y series masses for a given AASequence
void adjustExtractionWindow(double &right, double &left, const double &mz_extract_window, const bool &mz_extraction_ppm)
Adjust left/right window based on window and whether its ppm or not.
void extractFirst(const std::vector< std::pair< double, double > > &peaks, std::vector< double > &mass)
extract first from vector of pairs
void integrateDriftSpectrum(const OpenSwath::SpectrumPtr &spectrum, double mz_start, double mz_end, double &im, double &intensity, double drift_start, double drift_end)
Integrate intensity in an ion mobility spectrum from start to end.
void simulateSpectrumFromAASequence(const AASequence &aa, std::vector< double > &first_isotope_masses, std::vector< std::pair< double, double > > &isotope_masses, TheoreticalSpectrumGenerator const *g, int charge=1)
simulate spectrum from AASequence
void addSinglePeakIsotopes2Spec(double mz, double ity, std::vector< std::pair< double, double > > &isotope_masses, Size nr_isotopes, int charge)
void addIsotopes2Spec(const std::vector< std::pair< double, double > > &spec, std::vector< std::pair< double, double > > &isotope_masses, Size nr_isotopes, int charge=1)
void getAveragineIsotopeDistribution(const double product_mz, std::vector< std::pair< double, double > > &isotopes_spec, const int charge=1, const int nr_isotopes=4, const double mannmass=1.00048)
get averagine distribution given mass
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:270