libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
peptidemodel.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/specglob/peptidemodel.h
3 * \date 14/11/2023
4 * \author Olivier Langella
5 * \brief SpecGlobTool peptide model
6 * \todo https://www.psidev.info/proforma
7 *
8 * C++ implementation of the SpecGlob algorithm described in :
9 * 1. Prunier, G. et al. Fast alignment of mass spectra in large proteomics
10 * datasets, capturing dissimilarities arising from multiple complex
11 * modifications of peptides. BMC Bioinformatics 24, 421 (2023).
12 *
13 * HAL Id : hal-04296170 , version 1
14 * Mot de passe : hxo20cl
15 * DOI : 10.1186/s12859-023-05555-y
16 */
17
18
19/*
20 * SpecGlobTool, Spectra to peptide alignment tool
21 * Copyright (C) 2023 Olivier Langella
22 * <olivier.langella@universite-paris-saclay.fr>
23 *
24 * This program is free software: you can redistribute ipetide to spectrum
25 * alignmentt and/or modify it under the terms of the GNU General Public License
26 * as published by the Free Software Foundation, either version 3 of the
27 * License, or (at your option) any later version.
28 *
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
33 *
34 * You should have received a copy of the GNU General Public License
35 * along with this program. If not, see <http://www.gnu.org/licenses/>.
36 *
37 */
38
39#pragma once
40
41#include "../../peptide/peptide.h"
42#include "../../massspectrum/qualifiedmassspectrum.h"
43#include "types.h"
44#include "../../exportinmportconfig.h"
45
46namespace pappso
47{
48namespace specglob
49{
50
59
60
62{
64 std::vector<pappso::DataPoint>::const_iterator
65 it_experimental_peak_match; // intensity of experimental matched peak
66 std::size_t aa_indice; // the amino acid indice in the peptide model (from 0
67 // to size, begining by nter)
68};
69/**
70 * @todo write docs
71 */
72class PMSPP_LIB_DECL PeptideModel : public std::vector<AminoAcidModel>
73{
74 public:
75 /**
76 * Default constructor
77 */
78 PeptideModel(const pappso::QualifiedMassSpectrum &qmass_spectrum,
79 const pappso::Peptide &peptide);
80
82 /**
83 * Copy constructor
84 *
85 * @param other TODO
86 */
87 PeptideModel(const PeptideModel &other);
88
89 /**
90 * Destructor
91 */
92 virtual ~PeptideModel();
93
94 QString toString() const;
95
96 // void setPrecursorMass(double precursor_mass);
97
98 double getMass() const;
99
100 /** @brief get the m/z peptide model mass
101 * */
102 pappso_double getMz(unsigned int charge) const;
103
104 /** @brief mass delta between experimental and theoretical mass
105 */
106 double getMassDelta() const;
107
108 std::size_t modifCount() const;
109
110 void setBeginMassDelta(double);
111
112 void matchExperimentalPeaks(pappso::PrecisionPtr precision);
113
114 std::vector<double> getTheoreticalIonMassList() const;
115
116
117 std::size_t getCountSharedPeaks() const;
118 double getIntensitySharedPeaks() const;
119 double getIntensityExperimentalPeaks() const;
120
121 void assignResidualMass2Cter();
122
123 /**
124 * Use to delete offset when there is two opposite mass in the hit modified
125 * example : [150.2]SDS[-150.2]KR --> SDSKR
126 *
127 * @param precision : The mass spectrometer precision
128 * @return true if model is modified
129 */
130 bool eliminateComplementaryDelta(pappso::PrecisionPtr precision);
131
132 /** @brief try to replace mass differences with corresponding mutations mass
133 * delta
134 *
135 * amino acid list is tested as raw (no modification)
136 *
137 * @param aa_list amno acid list to test (beware of cysteine +
138 * carbamidomethyl)
139 * @param precision : The mass spectrometer precision
140 * @return true if model is modified
141 */
142 bool checkForMutations(const std::vector<AminoAcidChar> &aa_list,
143 pappso::PrecisionPtr precision);
144
145
146 /** @brief try to replace mass differences with corresponding mutation mass
147 * delta
148 *
149 * amino acid candidate tested could bear some modifications
150 *
151 * @param amino_acid_candidate : The amino acid candidate to check
152 * @param precision : The mass spectrometer precision
153 * @return true if model is modified
154 */
155 bool checkForMutation(const pappso::Aa &amino_acid_candidate,
156 pappso::PrecisionPtr precision);
157
158
159 /** @brief try to replace mass differences with the given modifications on a
160 * specific amino acid
161 *
162 * @param aa_modified the modified amino acid
163 * @param precision The mass spectrometer precision
164 * @return true if model is modified
165 */
166 bool checkForAaModification(const pappso::Aa &aa_modified,
167 pappso::PrecisionPtr precision);
168
169 /** @brief try to replace mass differences with the given modification
170 *
171 * @param modification : The proposed modification pointer
172 * @param precision : The mass spectrometer precision
173 * @return true if model is modified
174 */
175 bool checkForAaModificationP(pappso::AaModificationP modification,
176 pappso::PrecisionPtr precision);
177
178 PeptideModel &operator=(const PeptideModel &other);
179
180 PeptideModel &copyDeep(const PeptideModel &other);
181 /**
182 * Use to try to explain negative offset with deletion of amino acids
183 *
184 * @param precision : The mass spectrometer precision
185 * @return true if model is modified
186 */
187 bool eliminateNegativeOffset(pappso::PrecisionPtr precision);
188
189
190 /**
191 * Use to remove brackets around not found Amino acids when the B or Y peak
192 * corresponding to the amino acid in the sequence is in the experimental peak
193 * list
194 *
195 * @param betterModified : The better sequence of hit Modified
196 * @param experimentalMassList : The list of mass that are in the experimental
197 * spectrum
198 * @param precision : The precision of the mass spectrometer
199 * @return the new sequence without brackets around found amino acids after
200 * all post treatments
201 */
202 bool removeBracketsForAlignedAA();
203
204 const std::vector<TheoreticalPeakDataPoint> &
205 getTheoreticalPeakDataPointList() const;
206
207 QString getTheoreticalPeakDataPointListToString() const;
208
209 /** @brief get the peptide model in ProForma notation
210 * https://github.com/HUPO-PSI/ProForma/blob/master/README.md
211 * @return QString as described in ProForma
212 */
213 QString toProForma() const;
214
215 bool hasRemoval() const;
216
217 /** @brief try to remove left amino acid if there is a removal
218 * @return true if peptide model is modified
219 */
220 bool ltrimOnRemoval();
221
222 private:
223 void generateTheoreticalPeaks(pappso::PrecisionPtr precision);
224
225 private:
226 std::vector<TheoreticalPeakDataPoint> m_theoreticalPeakList;
227
229 double m_beginMassDelta = 0;
230 pappso::MassSpectrumCstSPtr mcsp_peakList = nullptr;
231
234
235 std::size_t m_countSharedPeaks = 0;
236 double m_intensitySharedPeaks = 0;
237 double m_intensityExperimentalPeaks = 0;
238};
239} // namespace specglob
240} // namespace pappso
Class representing a fully specified mass spectrum.
pappso::AaModificationP m_nterModification
std::vector< TheoreticalPeakDataPoint > m_theoreticalPeakList
pappso::AaModificationP m_cterModification
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
double pappso_double
A type definition for doubles.
Definition types.h:50
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
SpectralAlignmentType alignment_type
std::vector< pappso::DataPoint >::const_iterator it_experimental_peak_match
This header contains all the type re-definitions and all the global variables definitions used in the...