OpenMS
DIAHelper.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-2023.
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: Witold Wolski, Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
39 
40 #include <vector>
41 
42 namespace OpenMS
43 {
44  class TheoreticalSpectrumGenerator;
45  namespace DIAHelpers
46  {
47 
52 
64  OPENMS_DLLAPI bool integrateWindow(const OpenSwath::SpectrumPtr& spectrum, double mz_start,
65  double mz_end, double& mz, double& intensity, bool centroided = false);
66 
70  OPENMS_DLLAPI void integrateWindows(const OpenSwath::SpectrumPtr& spectrum,
71  const std::vector<double>& windows_center,
72  double width,
73  std::vector<double>& integrated_windows_intensity,
74  std::vector<double>& integrated_windows_mz,
75  bool remove_zero = false);
76 
86  OPENMS_DLLAPI void integrateDriftSpectrum(const OpenSwath::SpectrumPtr& spectrum,
87  double mz_start,
88  double mz_end,
89  double & im,
90  double & intensity,
91  double drift_start,
92  double drift_end);
93 
97  OPENMS_DLLAPI void adjustExtractionWindow(double& right, double& left, const double& mz_extract_window, const bool& mz_extraction_ppm);
98 
100  OPENMS_DLLAPI void getBYSeries(const AASequence& a,
101  std::vector<double>& bseries,
102  std::vector<double>& yseries,
104  int charge = 1);
105 
107  OPENMS_DLLAPI void getTheorMasses(const AASequence& a,
108  std::vector<double>& masses,
110  int charge = 1);
111 
113  OPENMS_DLLAPI void getAveragineIsotopeDistribution(const double product_mz,
114  std::vector<std::pair<double, double> >& isotopes_spec,
115  const int charge = 1,
116  const int nr_isotopes = 4,
117  const double mannmass = 1.00048);
118 
120  OPENMS_DLLAPI void simulateSpectrumFromAASequence(const AASequence& aa,
121  std::vector<double>& first_isotope_masses, //[out]
122  std::vector<std::pair<double, double> >& isotope_masses, //[out]
124  int charge = 1);
125 
127  OPENMS_DLLAPI void modifyMassesByCharge(const std::vector<std::pair<double, double> >& masses,
128  std::vector<std::pair<double, double> >& modmass,
129  int charge = 1);
130 
132  OPENMS_DLLAPI void addPreisotopeWeights(const std::vector<double>& first_isotope_masses,
133  std::vector<std::pair<double, double> >& isotope_spec, // output
134  UInt nr_peaks = 2, //nr of pre-isotope peaks
135  double pre_isotope_peaks_weight = -0.5, // weight of pre-isotope peaks
136  double mannmass = 1.000482, //
137  int charge = 1);
138 
140  OPENMS_DLLAPI void addPreisotopeWeights(double mz,
141  std::vector<std::pair<double, double> >& isotope_spec, // output
142  UInt nr_peaks = 2, //nr of pre-isotope peaks
143  double pre_isotope_peaks_weight = -0.5, // weight of pre-isotope peaks
144  double mannmass = 1.000482, //
145  int charge = 1);
146 
149  OPENMS_DLLAPI void addIsotopes2Spec(const std::vector<std::pair<double, double> >& spec,
150  std::vector<std::pair<double, double> >& isotope_masses, //[out]
151  Size nr_isotopes, int charge = 1);
152 
155  OPENMS_DLLAPI void addSinglePeakIsotopes2Spec(double mz, double ity,
156  std::vector<std::pair<double, double> >& isotope_masses, //[out]
157  Size nr_isotopes, int charge);
158 
160  OPENMS_DLLAPI void sortByFirst(std::vector<std::pair<double, double> >& tmp);
162  OPENMS_DLLAPI void extractFirst(const std::vector<std::pair<double, double> >& peaks, std::vector<double>& mass);
164  OPENMS_DLLAPI void extractSecond(const std::vector<std::pair<double, double> >& peaks, std::vector<double>& mass);
165 
167  }
168 }
169 
Representation of a peptide/protein sequence.
Definition: AASequence.h:112
Generates theoretical spectra for peptides with various options.
Definition: TheoreticalSpectrumGenerator.h:70
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
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:48
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h:296