libpappsomspp
Library for mass spectrometry
pappso::PeptideIsotopeSpectrumMatch Class Reference

#include <peptideisotopespectrummatch.h>

Public Types

typedef std::list< PeakIonIsotopeMatch >::const_iterator const_iterator
 

Public Member Functions

 PeptideIsotopeSpectrumMatch (const MassSpectrum &spectrum, const PeptideSp &peptide_sp, unsigned int parent_charge, PrecisionPtr precision, const std::list< PeptideIon > &ion_type_list, unsigned int max_isotope_number, unsigned int max_isotope_rank)
 annotate spectrum with peptide ions and isotopes More...
 
 PeptideIsotopeSpectrumMatch (const MassSpectrum &spectrum, std::vector< PeptideNaturalIsotopeAverageSp > v_peptideIsotopeList, std::vector< PeptideFragmentIonSp > v_peptideIonList, PrecisionPtr precision)
 
 PeptideIsotopeSpectrumMatch (const PeptideIsotopeSpectrumMatch &other)
 
virtual ~PeptideIsotopeSpectrumMatch ()
 
const std::list< PeakIonIsotopeMatch > & getPeakIonIsotopeMatchList () const
 
std::size_t size () const
 
const_iterator begin () const
 
const_iterator end () const
 
void dropPeaksLackingMonoisotope ()
 

Private Member Functions

virtual std::vector< DataPoint >::iterator getBestPeakIterator (std::vector< DataPoint > &peak_list, const PeptideNaturalIsotopeAverage &ion) const
 

Private Attributes

PrecisionPtr _precision
 
std::list< PeakIonIsotopeMatch_peak_ion_match_list
 

Detailed Description

Definition at line 39 of file peptideisotopespectrummatch.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 71 of file peptideisotopespectrummatch.h.

Constructor & Destructor Documentation

◆ PeptideIsotopeSpectrumMatch() [1/3]

pappso::PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch ( const MassSpectrum spectrum,
const PeptideSp peptide_sp,
unsigned int  parent_charge,
PrecisionPtr  precision,
const std::list< PeptideIon > &  ion_type_list,
unsigned int  max_isotope_number,
unsigned int  max_isotope_rank 
)

annotate spectrum with peptide ions and isotopes

Parameters
spectrumthe spectrum to annotate
peptide_sppeptide to fragment
parent_chargecharge of the ion parent
precisionMS2 mass measurement precision
ion_listion types to compute fragments
max_isotope_numbermaximum isotope number to compute (0 means only monoisotope is computed)
max_isotope_rankmaximum rank inside isotope level to compute

Definition at line 30 of file peptideisotopespectrummatch.cpp.

38 : _precision(precision)
39{
40
41 try
42 {
44 qDebug() << "PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
45 "begin max_isotope_number="
46 << max_isotope_number;
47 PeptideFragmentIonListBase fragmentIonList(peptideSp, ion_type_list);
48 qDebug() << "PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
49 "peak_list spectrum.size="
50 << spectrum.size();
51 std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
52 for(auto ion_type : ion_type_list)
53 {
54 auto ion_list = fragmentIonList.getPeptideFragmentIonSp(ion_type);
55
56 for(unsigned int charge = 1; charge <= parent_charge; charge++)
57 {
58 for(auto &&ion : ion_list)
59 {
60 unsigned int askedIsotopeRank = 1;
61 for(unsigned int isotope_number = 0;
62 isotope_number <= max_isotope_number;
63 isotope_number++)
64 {
65 PeptideNaturalIsotopeAverage isotopeIon(
66 ion, isotope_number, charge, precision);
67
68 qDebug()
69 << isotope_number << " " << isotopeIon.toString();
70
71 std::vector<DataPoint>::iterator it_peak =
72 getBestPeakIterator(peak_list, isotopeIon);
73 if(it_peak != peak_list.end())
74 {
75 _peak_ion_match_list.push_back(PeakIonIsotopeMatch(
76 *it_peak,
77 isotopeIon.makePeptideNaturalIsotopeAverageSp(),
78 ion));
79 peak_list.erase(it_peak);
80
81 qDebug() << isotope_number << " "
82 << _peak_ion_match_list.back().toString();
83 }
84 }
85 }
86 }
87 }
88 }
89 catch(PappsoException &exception_pappso)
90 {
91 QString errorStr =
92 QObject::tr(
93 "ERROR building PeptideIsotopeSpectrumMatch, PAPPSO exception:\n%1")
94 .arg(exception_pappso.qwhat());
95 qDebug() << "PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
96 "PappsoException :\n"
97 << errorStr;
98 throw PappsoException(errorStr);
99 }
100 catch(std::exception &exception_std)
101 {
102 QString errorStr =
103 QObject::tr(
104 "ERROR building PeptideIsotopeSpectrumMatch, std exception:\n%1")
105 .arg(exception_std.what());
106 qDebug() << "PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
107 "std::exception :\n"
108 << errorStr;
109 throw PappsoException(errorStr);
110 }
111}
std::list< PeakIonIsotopeMatch > _peak_ion_match_list
virtual std::vector< DataPoint >::iterator getBestPeakIterator(std::vector< DataPoint > &peak_list, const PeptideNaturalIsotopeAverage &ion) const

References _peak_ion_match_list, getBestPeakIterator(), pappso::PeptideFragmentIonListBase::getPeptideFragmentIonSp(), pappso::PeptideNaturalIsotopeAverage::makePeptideNaturalIsotopeAverageSp(), pappso::PappsoException::qwhat(), and pappso::PeptideNaturalIsotopeAverage::toString().

◆ PeptideIsotopeSpectrumMatch() [2/3]

pappso::PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch ( const MassSpectrum spectrum,
std::vector< PeptideNaturalIsotopeAverageSp v_peptideIsotopeList,
std::vector< PeptideFragmentIonSp v_peptideIonList,
PrecisionPtr  precision 
)

Definition at line 113 of file peptideisotopespectrummatch.cpp.

118 : _precision(precision)
119{
120 qDebug() << " begin";
121 if(v_peptideIsotopeList.size() != v_peptideIonList.size())
122 {
123 throw PappsoException(
124 QObject::tr(
125 "v_peptideIsotopeList.size() %1 != v_peptideIonList.size() %2")
126 .arg(v_peptideIsotopeList.size())
127 .arg(v_peptideIonList.size()));
128 }
129
130 auto isotopeIt = v_peptideIsotopeList.begin();
131 auto ionIt = v_peptideIonList.begin();
132 std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
133
134 while(isotopeIt != v_peptideIsotopeList.end())
135 {
136 std::vector<DataPoint>::iterator it_peak =
137 getBestPeakIterator(peak_list, *(isotopeIt->get()));
138 if(it_peak != peak_list.end())
139 {
140 _peak_ion_match_list.push_back(
141 PeakIonIsotopeMatch(*it_peak, *isotopeIt, *ionIt));
142 peak_list.erase(it_peak);
143 }
144 isotopeIt++;
145 ionIt++;
146 }
147 qDebug() << " end";
148}

References _peak_ion_match_list, and getBestPeakIterator().

◆ PeptideIsotopeSpectrumMatch() [3/3]

pappso::PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch ( const PeptideIsotopeSpectrumMatch other)

Definition at line 151 of file peptideisotopespectrummatch.cpp.

153 : _precision(other._precision),
154 _peak_ion_match_list(other._peak_ion_match_list)
155{
156 qDebug();
157}

◆ ~PeptideIsotopeSpectrumMatch()

pappso::PeptideIsotopeSpectrumMatch::~PeptideIsotopeSpectrumMatch ( )
virtual

Definition at line 159 of file peptideisotopespectrummatch.cpp.

160{
161}

Member Function Documentation

◆ begin()

PeptideIsotopeSpectrumMatch::const_iterator pappso::PeptideIsotopeSpectrumMatch::begin ( ) const

Definition at line 204 of file peptideisotopespectrummatch.cpp.

205{
206 return _peak_ion_match_list.begin();
207}

References _peak_ion_match_list.

◆ dropPeaksLackingMonoisotope()

void pappso::PeptideIsotopeSpectrumMatch::dropPeaksLackingMonoisotope ( )

Definition at line 215 of file peptideisotopespectrummatch.cpp.

216{
217 qDebug();
219 [](const PeakIonIsotopeMatch &a, const PeakIonIsotopeMatch &b) {
220 if(a.getPeptideIonType() < b.getPeptideIonType())
221 return true;
222 if(a.getPeptideFragmentIonSp().get()->size() <
223 b.getPeptideFragmentIonSp().get()->size())
224 return true;
225 if(a.getCharge() < b.getCharge())
226 return true;
227 if(a.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() <
228 b.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
229 return true;
230 return false;
231 });
232 PeptideIon ion_type = PeptideIon::b;
233 std::size_t nserie = 0;
234 std::size_t isotopeserie = 0;
235 unsigned int charge = 0;
236 for(std::list<PeakIonIsotopeMatch>::iterator it =
237 _peak_ion_match_list.begin();
238 it != _peak_ion_match_list.end();
239 it++)
240 {
241 if((nserie != it->getPeptideFragmentIonSp().get()->size()) ||
242 (ion_type != it->getPeptideIonType()) || (charge != it->getCharge()))
243 {
244 ion_type = it->getPeptideIonType();
245 isotopeserie = 0;
246 nserie = it->getPeptideFragmentIonSp().get()->size();
247 charge = it->getCharge();
248 }
249 if(isotopeserie <=
250 it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
251 {
252 isotopeserie =
253 it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
254 }
255 else
256 {
257 it = _peak_ion_match_list.erase(it);
258 }
259 }
260 qDebug();
261}
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition: types.h:385
@ b
Nter acylium ions.

References _peak_ion_match_list, pappso::a, and pappso::b.

◆ end()

PeptideIsotopeSpectrumMatch::const_iterator pappso::PeptideIsotopeSpectrumMatch::end ( ) const

Definition at line 209 of file peptideisotopespectrummatch.cpp.

210{
211 return _peak_ion_match_list.end();
212}

References _peak_ion_match_list.

◆ getBestPeakIterator()

std::vector< DataPoint >::iterator pappso::PeptideIsotopeSpectrumMatch::getBestPeakIterator ( std::vector< DataPoint > &  peak_list,
const PeptideNaturalIsotopeAverage ion 
) const
privatevirtual

Definition at line 165 of file peptideisotopespectrummatch.cpp.

168{
169 // qDebug();
170 std::vector<DataPoint>::iterator itpeak = peak_list.begin();
171 std::vector<DataPoint>::iterator itend = peak_list.end();
172 std::vector<DataPoint>::iterator itselect = peak_list.end();
173
174 pappso_double best_intensity = 0;
175
176 while(itpeak != itend)
177 {
178 if(ion.matchPeak(itpeak->x))
179 {
180 if(itpeak->y > best_intensity)
181 {
182 best_intensity = itpeak->y;
183 itselect = itpeak;
184 }
185 }
186 itpeak++;
187 }
188 // qDebug();
189 return (itselect);
190}
double pappso_double
A type definition for doubles.
Definition: types.h:48

References pappso::PeptideNaturalIsotopeAverage::matchPeak().

Referenced by PeptideIsotopeSpectrumMatch().

◆ getPeakIonIsotopeMatchList()

const std::list< PeakIonIsotopeMatch > & pappso::PeptideIsotopeSpectrumMatch::getPeakIonIsotopeMatchList ( ) const

◆ size()

std::size_t pappso::PeptideIsotopeSpectrumMatch::size ( ) const

Definition at line 199 of file peptideisotopespectrummatch.cpp.

200{
201 return _peak_ion_match_list.size();
202}

References _peak_ion_match_list.

Member Data Documentation

◆ _peak_ion_match_list

std::list<PeakIonIsotopeMatch> pappso::PeptideIsotopeSpectrumMatch::_peak_ion_match_list
private

◆ _precision

PrecisionPtr pappso::PeptideIsotopeSpectrumMatch::_precision
private

Definition at line 84 of file peptideisotopespectrummatch.h.


The documentation for this class was generated from the following files: