libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
peakionisotopematch.cpp
Go to the documentation of this file.
1/*
2 * *******************************************************************************
3 * * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
4 * *
5 * * This file is part of MassChroqPRM.
6 * *
7 * * MassChroqPRM is free software: you can redistribute it and/or modify
8 * * it under the terms of the GNU General Public License as published by
9 * * the Free Software Foundation, either version 3 of the License, or
10 * * (at your option) any later version.
11 * *
12 * * MassChroqPRM is distributed in the hope that it will be useful,
13 * * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * * GNU General Public License for more details.
16 * *
17 * * You should have received a copy of the GNU General Public License
18 * * along with MassChroqPRM. If not, see <http://www.gnu.org/licenses/>.
19 * *
20 * * Contributors:
21 * * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
22 * implementation
23 * ******************************************************************************/
24
25#include "peakionisotopematch.h"
26
27namespace pappso
28{
29std::vector<PeakIonIsotopeMatch>::iterator
30findComplementIonType(std::vector<PeakIonIsotopeMatch>::iterator begin,
31 std::vector<PeakIonIsotopeMatch>::iterator end,
32 const PeakIonIsotopeMatch &peak_ion,
33 std::size_t peptide_size)
34{
35
36 return std::find_if(begin, end, [peak_ion, peptide_size](const PeakIonIsotopeMatch &to_compare) {
37 if(to_compare.getCharge() == peak_ion.getCharge())
38 {
39 if((to_compare.getPeptideFragmentIonSp().get()->size() +
40 peak_ion.getPeptideFragmentIonSp().get()->size()) == peptide_size)
41 {
42 if(peptideIonTypeIsComplement(to_compare.getPeptideIonType(),
43 peak_ion.getPeptideIonType()))
44 {
45 if(to_compare.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() ==
46 peak_ion.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
47 {
48 return true;
49 }
50 }
51 }
52 }
53
54 return false;
55 });
56}
57
58
59PeakIonIsotopeMatch::PeakIonIsotopeMatch(
60 const DataPoint &peak,
61 const PeptideNaturalIsotopeAverageSp &naturalIsotopeAverageSp,
62 const PeptideFragmentIonSp &ion_sp)
63 : PeakIonMatch(peak, ion_sp, naturalIsotopeAverageSp.get()->getCharge()),
64 _naturalIsotopeAverageSp(naturalIsotopeAverageSp)
65{
66 qDebug();
67}
68
73
74
76 : PeakIonMatch(std::move(other))
77{
78 _naturalIsotopeAverageSp = other._naturalIsotopeAverageSp;
79}
80
89
90
99
100
101QString
103{
104 return QString("%1isotope%2r%3mz%4")
106 .arg(_naturalIsotopeAverageSp.get()->getIsotopeNumber())
107 .arg(_naturalIsotopeAverageSp.get()->getIsotopeRank())
108 .arg(getPeak().x);
109}
110
111} // namespace pappso
PeakIonIsotopeMatch(const DataPoint &peak, const PeptideNaturalIsotopeAverageSp &naturalIsotopeAverageSp, const PeptideFragmentIonSp &ion_sp)
virtual QString toString() const
PeakIonIsotopeMatch & operator=(const PeakIonIsotopeMatch &other)
PeptideNaturalIsotopeAverageSp _naturalIsotopeAverageSp
virtual const PeptideNaturalIsotopeAverageSp & getPeptideNaturalIsotopeAverageSp() const
const DataPoint & getPeak() const
virtual QString toString() const
PeakIonMatch & operator=(const PeakIonMatch &other)
unsigned int getCharge() const
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< const PeptideFragmentIon > PeptideFragmentIonSp
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
std::vector< PeakIonIsotopeMatch >::iterator findComplementIonType(std::vector< PeakIonIsotopeMatch >::iterator begin, std::vector< PeakIonIsotopeMatch >::iterator end, const PeakIonIsotopeMatch &peak_ion, std::size_t peptide_size)
find the first element containing the complementary ion complementary ion of y1 is b(n-1) for instanc...