libpappsomspp
Library for mass spectrometry
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 
27 namespace pappso
28 {
29 std::vector<PeakIonIsotopeMatch>::iterator
30 findComplementIonType(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(
37  begin,
38  end,
39  [peak_ion, peptide_size](const PeakIonIsotopeMatch &to_compare) {
40  if(to_compare.getCharge() == peak_ion.getCharge())
41  {
42  if((to_compare.getPeptideFragmentIonSp().get()->size() +
43  peak_ion.getPeptideFragmentIonSp().get()->size()) == peptide_size)
44  {
45  if(peptideIonTypeIsComplement(to_compare.getPeptideIonType(),
46  peak_ion.getPeptideIonType()))
47  {
48  if(to_compare.getPeptideNaturalIsotopeAverageSp()
49  .get()
50  ->getIsotopeNumber() ==
51  peak_ion.getPeptideNaturalIsotopeAverageSp()
52  .get()
53  ->getIsotopeNumber())
54  {
55  return true;
56  }
57  }
58  }
59  }
60 
61  return false;
62  });
63 }
64 
65 
66 PeakIonIsotopeMatch::PeakIonIsotopeMatch(
67  const DataPoint &peak,
68  const PeptideNaturalIsotopeAverageSp &naturalIsotopeAverageSp,
69  const PeptideFragmentIonSp &ion_sp)
70  : PeakIonMatch(peak, ion_sp, naturalIsotopeAverageSp.get()->getCharge()),
71  _naturalIsotopeAverageSp(naturalIsotopeAverageSp)
72 {
73  qDebug();
74 }
75 
77  : PeakIonMatch(other)
78 {
80 }
81 
82 
84  : PeakIonMatch(std::move(other))
85 {
86  _naturalIsotopeAverageSp = other._naturalIsotopeAverageSp;
87 }
88 
90 {
91 }
94 {
96 }
97 
98 
101 {
104 
105  return *this;
106 }
107 
108 
109 QString
111 {
112  return QString("%1isotope%2r%3mz%4")
113  .arg(PeakIonMatch::toString())
114  .arg(_naturalIsotopeAverageSp.get()->getIsotopeNumber())
115  .arg(_naturalIsotopeAverageSp.get()->getIsotopeRank())
116  .arg(getPeak().x);
117 }
118 
119 } // 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...