libpappsomspp
Library for mass spectrometry
psmfeatures.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/psm/features/psmfeatures.h
3  * \date 19/07/2022
4  * \author Olivier Langella
5  * \brief comutes various PSM (Peptide Spectrum Match) features
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2022 Olivier Langella <Olivier.Langella@u-psud.fr>.
10  *
11  * This file is part of PAPPSOms-tools.
12  *
13  * PAPPSOms-tools is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * PAPPSOms-tools is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
25  *
26  ******************************************************************************/
27 
28 #pragma once
29 
30 #include "../../massspectrum/massspectrum.h"
31 #include "../../mzrange.h"
32 #include "../../peptide/peptidefragmention.h"
33 #include "../../processing/filters/filterchargedeconvolution.h"
34 #include "../../processing/filters/filterexclusionmz.h"
35 #include "../../processing/filters/filterresample.h"
36 #include "../peptideisotopespectrummatch.h"
37 
38 namespace pappso
39 {
40 /**
41  * @todo write docs
42  */
44 {
45  public:
46  /** @brief compute psm features
47  * @param ms2precision precision of mass measurements for MS2 fragments
48  * @param minimumMz ignore mz values under this threshold
49  */
50  PsmFeatures(PrecisionPtr ms2precision, double minimumMz);
51 
52  /**
53  * Destructor
54  */
55  ~PsmFeatures();
56 
57  void setPeptideSpectrumCharge(const pappso::PeptideSp peptideSp,
58  const MassSpectrum *p_spectrum,
59  unsigned int parent_charge);
60 
61  /** @brief get the sum of intensity of a specific ion
62  * @param ion_type ion species (y, b, ...)
63  */
64  double getIntensityOfMatchedIon(PeptideIon ion_type);
65 
66  /** @brief sum of all peak intensities (matched or not)
67  */
68  double getTotalIntensity() const;
69 
70 
71  /** @brief sum of matched peak intensities
72  */
73  double getTotalIntensityOfMatchedIons() const;
74 
75  /** @brief number of matched ions (peaks)
76  */
77  std::size_t getNumberOfMatchedIons() const;
78 
79  /** @brief count the number of matched ion complement
80  *
81  * matched ion complement are ions with a sum compatible to the precursor mass
82  *
83  */
84  std::size_t countMatchedIonComplementPairs() const;
85 
86  /** @brief intensity of matched ion complement
87  */
88  double getTotalIntensityOfMatchedIonComplementPairs() const;
89 
90  const std::vector<
91  std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch>> &
92  getPeakIonPairs() const;
93 
94 
95  /** @brief get mean deviation of matched peak mass delta
96  */
97  double getMatchedMzDiffMean() const;
98 
99 
100  /** @brief get standard deviation of matched peak mass delta
101  */
102  double getMatchedMzDiffSd() const;
103 
104 
105  /** @brief get the precursor mass delta of the maximum intensity pair of
106  * complement ions
107  */
108  double getMaxIntensityMatchedIonComplementPairPrecursorMassDelta() const;
109 
110 
111  /** @brief get the maximum consecutive fragments of one ion type
112  * @param ion_type ion species (y, b, ...)
113  */
114  std::size_t getMaxConsecutiveIon(PeptideIon ion_type);
115 
116  /** @brief number of amino acid covered by matched ions
117  */
118  std::size_t getAaSequenceCoverage(PeptideIon ion_type);
119 
120 
121  /** @brief number of amino acid covered by matched complement pairs of ions
122  */
123  std::size_t getComplementPairsAaSequenceCoverage();
124 
125  double getMaxIntensityPeakIonMatch(PeptideIon ion_type) const;
126 
127 
128  double getIonPairPrecursorMassDelta(
129  const std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch>
130  &ion_pair) const;
131 
132 
133  private:
134  void findComplementIonPairs(const pappso::PeptideSp &peptideSp);
135 
136  private:
137  std::shared_ptr<FilterChargeDeconvolution> msp_filterChargeDeconvolution;
138  std::shared_ptr<FilterMzExclusion> msp_filterMzExclusion;
139  std::shared_ptr<FilterResampleKeepGreater> msp_filterKeepGreater;
140 
141  std::shared_ptr<PeptideIsotopeSpectrumMatch> msp_peptideSpectrumMatch;
143 
145  std::list<PeptideIon> m_ionList;
146 
148 
151  unsigned int m_parentCharge = 1;
152 
153  std::vector<
154  std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch>>
156 
157  double m_matchedMzDiffMean = 0;
158  double m_matchedMzDiffMedian = 0;
159  double m_matchedMzDiffSd = 0;
160 };
161 } // namespace pappso
Class to represent a mass spectrum.
Definition: massspectrum.h:71
std::vector< std::pair< pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch > > m_peakIonPairs
Definition: psmfeatures.h:155
std::shared_ptr< FilterChargeDeconvolution > msp_filterChargeDeconvolution
Definition: psmfeatures.h:137
std::shared_ptr< FilterResampleKeepGreater > msp_filterKeepGreater
Definition: psmfeatures.h:139
std::shared_ptr< FilterMzExclusion > msp_filterMzExclusion
Definition: psmfeatures.h:138
double m_precursorTheoreticalMz
Definition: psmfeatures.h:149
std::list< PeptideIon > m_ionList
Definition: psmfeatures.h:145
std::shared_ptr< PeptideIsotopeSpectrumMatch > msp_peptideSpectrumMatch
Definition: psmfeatures.h:141
PrecisionPtr m_ms2precision
Definition: psmfeatures.h:144
pappso::PeptideSp msp_peptide
Definition: psmfeatures.h:142
double m_precursorTheoreticalMass
Definition: psmfeatures.h:150
double m_spectrumSumIntensity
Definition: psmfeatures.h:147
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition: types.h:386
std::shared_ptr< const Peptide > PeptideSp