libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
xtandemspectrumprocess.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/psm/xtandem/xtandemhyperscore.cpp
3 * \date 16/8/2016
4 * \author Olivier Langella
5 * \brief process spectrum to compute X!Tandem hyperscore
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ 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++ 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++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Contributors:
27 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
28 *implementation
29 ******************************************************************************/
30
32#include <QDebug>
33
34namespace pappso
35{
36
41
47{
52
57 _y_ions = copy._y_ions; // Enums::PeptideIon::y
58 _b_ions = copy._b_ions; // Enums::PeptideIon::b
59 _ystar_ions = copy._ystar_ions; // Enums::PeptideIon::ystar
60 _bstar_ions = copy._bstar_ions; // Enums::PeptideIon::bstar
61 _c_ions = copy._c_ions; // Enums::PeptideIon::c
62 _z_ions = copy._z_ions; // Enums::PeptideIon::z
63 _a_ions = copy._a_ions; // Enums::PeptideIon::a
64 _x_ions = copy._x_ions; // CO2
65
66 _astar_ions = copy._astar_ions; // Enums::PeptideIon::a
67 _ao_ions = copy._ao_ions;
68 _bo_ions = copy._bo_ions;
69 _yo_ions = copy._yo_ions;
70}
74
75void
80void
81XtandemSpectrumProcess::setNmostIntense(unsigned int nmost_intense)
82{
83 m_n_most_intense = FilterGreatestY(nmost_intense);
84}
85void
90
91void
93{
94 m_isRemoveIsotope = remove_isotope;
95}
96
97void
99{
100 m_isExcludeParent = exclude_parent;
101}
102void
107void
109{
110 m_neutralLossMass = neutral_loss_mass;
111}
112void
114{
115 m_neutralLossWindowDalton = neutral_loss_precision;
116}
117
118
119void
124
125// FIXME: enumeration values 'bp' and 'yp' not handled in switch
126void
128{
129 switch(ion_type)
130 {
132 _y_ions = compute_score;
133 break;
134
136 _b_ions = compute_score;
137 break;
138
140 _ystar_ions = compute_score;
141 break;
142
144 _bstar_ions = compute_score;
145 break;
146
148 _yo_ions = compute_score;
149 break;
150
152 _bo_ions = compute_score;
153 break;
154
156 _z_ions = compute_score;
157 break;
158
160 _a_ions = compute_score;
161 break;
162
164 _astar_ions = compute_score;
165 break;
167 _ao_ions = compute_score;
168 break;
170 _c_ions = compute_score;
171 break;
173 _x_ions = compute_score;
174 break;
175
178 break;
179 }
180}
181
184{
185 return m_filter_keep_greater.getThresholdX();
186}
187unsigned int
189{
190 return m_n_most_intense.getNumberOfPoints();
191}
194{
195 return m_filter_rescale.getDynamicRange();
196}
197bool
202bool
207bool
222
223bool
228
229// FIXME: enumeration values 'bp' and 'yp' not handled in switch
230bool
232{
233 switch(ion_type)
234 {
236 return _y_ions;
237
239 return _b_ions;
240
242 return _ystar_ions;
243
245 return _bstar_ions;
246
248 return _yo_ions;
249
251 return _bo_ions;
252
254 return _z_ions;
255
257 return _a_ions;
258
260 return _astar_ions;
262 return _ao_ions;
263
265 return _c_ions;
267 return _x_ions;
268 default:
269 break;
270 }
271 return false;
272}
273
276 pappso_double parent_ion_mz,
277 unsigned int parent_charge) const
278{
279 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
280 << " parent_charge==" << parent_charge;
281
282 // 1) clean isotopes
283 MassSpectrum spectrum_process(spectrum);
285 {
286 spectrum_process.massSpectrumFilter(FilterTandemDeisotope());
287 }
288 qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()";
289 // 2) remove parent ion mass
291 {
293 parent_ion_mz,
296 }
297 qDebug() << spectrum_process.size();
298 // 3) remove low masses
299 // 4) normalization
300 m_filter_keep_greater.filter(spectrum_process);
301 qDebug() << spectrum_process.size();
302 m_filter_rescale.filter(spectrum_process);
303 qDebug() << spectrum_process.size();
304 // m_filter_floor.filter(spectrum_process);
305 m_filter_highpass.filter(spectrum_process);
306
307 qDebug() << spectrum_process.size();
308 // 5) remove neutral loss
310 {
311 pappso_double parent_ion_mhplus =
312 ((parent_ion_mz - (MHPLUS * parent_charge)) * parent_charge) + MHPLUS;
313
315 MzRange(parent_ion_mhplus - m_neutralLossMass,
317
318 filter_parent.filter(spectrum_process);
319 }
320 // 6) clean isotopes
321 // 7) keep n most intense peaks
322 qDebug() << spectrum_process.size() << " parent_charge==" << parent_charge;
323 // return spectrum_process.massSpectrumFilter(m_filter_remove_c13)
324 // .filter(m_nMostIntense);
325
326 m_filter_remove_c13.filter(spectrum_process);
327 m_n_most_intense.filter(spectrum_process);
328 qDebug() << spectrum_process.size();
329 return spectrum_process;
330}
331
332
333} // namespace pappso
keep N datapoints form the greatest intensities to the lowest
Definition filterpass.h:96
rescales Y values into a dynamic range if the dynamic range is set to 0, this filter is ignored
Definition filterpass.h:193
Deisotope the mass spectrum this mass spectrum is iterated over and according to a data point-based m...
MassSpectrum & filter(MassSpectrum &spectrum) const override
Class to represent a mass spectrum.
virtual MassSpectrum & massSpectrumFilter(const MassSpectrumFilterInterface &filter) final
apply a filter on this MassSpectrum
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
pappso::pappso_double m_isExcludeParent_upper_dalton
void setRemoveIsotope(bool remove_isotope)
void setIonScore(Enums::PeptideIon ion_type, bool compute_score)
pappso::pappso_double getDynamicRange() const
FilterResampleKeepGreater m_filter_keep_greater
pappso::pappso_double getNeutralLossMass() const
pappso::pappso_double m_isExcludeParent_lower_dalton
void setExcludeParentNeutralLoss(bool neutral_loss)
void setNeutralLossMass(pappso::pappso_double neutral_loss_mass)
FilterTandemDeisotope m_filter_remove_c13
void setMinimumMz(pappso_double minimum_mz)
void setNeutralLossWindowDalton(pappso::pappso_double neutral_loss_precision)
pappso::pappso_double getNeutralLossWindowDalton() const
bool getIonScore(Enums::PeptideIon ion_type) const
void setDynamicRange(pappso::pappso_double dynamic_range)
pappso::pappso_double m_neutralLossWindowDalton
MassSpectrum process(const MassSpectrum &spectrum, pappso_double parent_ion_mass, unsigned int parent_charge) const
process raw spectrum to prepare hyperscore computation
void setExcludeParent(bool exclude_parent)
void setNmostIntense(unsigned int nmost_intense)
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter)
Definition types.h:286
@ a
Nter aldimine ions.
Definition types.h:290
@ y
Cter amino ions.
Definition types.h:295
@ c
Nter amino ions.
Definition types.h:294
@ astar
Nter aldimine ions + NH3 loss.
Definition types.h:291
@ ystar
Cter amino ions + NH3 loss.
Definition types.h:296
@ yo
Cter amino ions + H2O loss.
Definition types.h:297
@ bstar
Nter acylium ions + NH3 loss.
Definition types.h:288
@ b
Nter acylium ions.
Definition types.h:287
@ x
Cter acylium ions.
Definition types.h:300
@ bo
Nter acylium ions + H2O loss.
Definition types.h:289
@ ao
Nter aldimine ions + H2O loss.
Definition types.h:292
@ z
Cter carbocations.
Definition types.h:298
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
const pappso_double MHPLUS(1.007276466879)
double pappso_double
A type definition for doubles.
Definition types.h:61