libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
peptidemodel.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/specglob/peptidemodel.cpp
3 * \date 05/10/2025
4 * \author Olivier Langella
5 * \brief SpecPeptidOMS peptide model
6 * \todo https://www.psidev.info/proforma
7 *
8 */
9
10
11/*
12 * SpecGlobTool, Spectra to peptide alignment tool
13 * Copyright (C) 2025 Olivier Langella
14 * <olivier.langella@universite-paris-saclay.fr>
15 *
16 * This program is free software: you can redistribute ipetide to spectrum
17 * alignmentt and/or modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation, either version 3 of the
19 * License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 *
29 */
30
31#include "peptidemodel.h"
32
33namespace pappso
34{
35namespace specpeptidoms
36{
37
38QString
40{
41 if(m_massDifference != 0)
42 {
43 return QString("%1[%2]")
44 .arg(m_aminoAcid.toProForma())
46 }
47 else
48 {
49 return m_aminoAcid.toProForma();
50 }
51}
52
53QString
55{
56 if(m_massDifference != 0)
57 {
58 if(m_skipped)
59 {
60 return QString("[%1][%2]")
61 .arg(m_aminoAcid.toString())
62 .arg(QString::number(m_massDifference));
63 }
64 else
65 {
66 return QString("%1[%2]")
67 .arg(m_aminoAcid.toString())
68 .arg(QString::number(m_massDifference));
69 }
70 }
71 else if(m_skipped)
72 {
73 return QString("[%1]").arg(m_aminoAcid.toString());
74 }
75 else
76 {
77 return m_aminoAcid.toString();
78 }
79}
83
87
88void
90{
91 this->clear();
92 m_cterShift = 0;
93 m_nterShift = 0;
95}
96void
98{
99 m_cterShift = mass_shift;
100}
101
102void
104{
105 m_nterShift = mass_shift;
106}
107
108void
110{
111 m_precursorMass = mass;
112}
113
114double
119QString
121{
122 if(mass > 0)
123 {
124 return QString("+%1").arg(QString::number(mass, 'f', 4));
125 }
126 else
127 {
128 return QString("%1").arg(QString::number(mass, 'f', 4));
129 }
130}
131
132double
134{
135 double mass = m_cterShift + m_nterShift + MASSH2O;
136 // qWarning() << mass;
137 for(auto &aa : *this)
138 {
139 // qWarning() << aa.m_aminoAcid.toProForma();
140 mass += aa.m_aminoAcid.getMass() + aa.m_massDifference;
141 }
142 return mass;
143}
144
145QString
147{
148
149 double mass_delta = m_precursorMass - getMass();
150
151 QString proforma("[");
152 if(mass_delta > 0)
153 {
154 proforma.append("+");
155 }
156 proforma.append(QString("%1]?").arg(QString::number(mass_delta, 'f', 4)));
157 proforma.replace("[+0.0000]?", "");
158 proforma.replace("[-0.0000]?", "");
159
160
161 // QString proforma;
162
163 if(size() > 0)
164 {
165 if(m_nterShift != 0)
166 {
167 proforma = '[' + toProFormaMass(m_nterShift) + "]-";
168 }
169 for(auto &aa : *this)
170 {
171 proforma.append(aa.toProForma());
172 }
173 if(m_cterShift != 0)
174 {
175 proforma = "-[" + toProFormaMass(m_cterShift) + ']';
176 }
177 }
178 return proforma;
179}
180QString
182{
183 QString proforma;
184
185 if(size() > 0)
186 {
187 if(m_nterShift > 0)
188 {
189 proforma = '[' + QString::number(m_nterShift) + "]";
190 }
191 for(auto &aa : *this)
192 {
193 proforma.append(aa.toInterpretation());
194 }
195 if(m_cterShift > 0)
196 {
197 proforma = "[" + QString::number(m_cterShift) + ']';
198 }
199 }
200 return proforma;
201}
202
203double
205{
206 return getPrecursorMass() - getMass();
207}
208
209} // namespace specpeptidoms
210} // namespace pappso
static QString toProFormaMass(double mass)
void setNterShift(double mass_shift)
void setCterShift(double mass_shift)
double getNonAlignedMass() const
Return the difference between the precursor's mass and the mass modelized by the PeptideModel.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)