27#include "../peptide/peptidenaturalisotopelist.h"
34 unsigned int parent_charge,
36 const std::list<PeptideIon> &ion_type_list,
37 unsigned int max_isotope_number,
38 [[maybe_unused]]
unsigned int max_isotope_rank)
39 : _precision(precision)
45 qDebug() <<
"peptideSp.get()->getSequence()="
46 << peptideSp.get()->getSequence()
47 <<
" max_isotope_number=" << max_isotope_number
48 <<
" spectrum.size=" << spectrum.size()
49 <<
" parent_charge=" << parent_charge
50 <<
" ion_type_list.size=" << ion_type_list.size()
51 <<
" max_isotope_rank=" << max_isotope_rank;
53 qDebug() <<
" fragmentIonList.size()=" << fragmentIonList.
size();
54 std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
55 for(
auto ion_type : ion_type_list)
57 const std::list<PeptideFragmentIonSp> peptide_fragment_ion_list =
59 qDebug() <<
" peptide_fragment_ion_list.size()="
60 << peptide_fragment_ion_list.size();
62 for(
unsigned int charge = 1; charge <= parent_charge; charge++)
65 for(
auto &&peptide_fragment_ion : peptide_fragment_ion_list)
67 qDebug() <<
"peptide_fragment_ion.get()->getMz(charge)="
68 << peptide_fragment_ion.get()->getMz(charge);
70 for(
unsigned int isotope_number = 0;
71 isotope_number <= max_isotope_number;
76 if(max_isotope_rank == 0)
96 <<
"max_isotope_rank=" << max_isotope_rank
97 <<
" isotope_number=" << isotope_number
98 <<
" charge=" << charge <<
" precision=" << precision
99 <<
" p_isotopeIon->getMz()=" << p_isotopeIon->
getMz()
100 <<
" " << isotope_number <<
" "
103 std::vector<DataPoint>::iterator it_peak =
105 if(it_peak != peak_list.end())
110 peptide_fragment_ion));
111 peak_list.erase(it_peak);
113 qDebug() << isotope_number <<
" "
126 "ERROR building PeptideIsotopeSpectrumMatch, PAPPSO exception:\n%1")
127 .arg(exception_pappso.
qwhat());
128 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
129 "PappsoException :\n"
133 catch(std::exception &exception_std)
137 "ERROR building PeptideIsotopeSpectrumMatch, std exception:\n%1")
138 .arg(exception_std.what());
139 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
150 std::vector<PeptideNaturalIsotopeAverageSp> v_peptideIsotopeList,
151 std::vector<PeptideFragmentIonSp> v_peptideIonList,
153 : _precision(precision)
155 qDebug() <<
" begin";
156 if(v_peptideIsotopeList.size() != v_peptideIonList.size())
160 "v_peptideIsotopeList.size() %1 != v_peptideIonList.size() %2")
161 .arg(v_peptideIsotopeList.size())
162 .arg(v_peptideIonList.size()));
165 auto isotopeIt = v_peptideIsotopeList.begin();
166 auto ionIt = v_peptideIonList.begin();
167 std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
169 while(isotopeIt != v_peptideIsotopeList.end())
171 std::vector<DataPoint>::iterator it_peak =
173 if(it_peak != peak_list.end())
177 peak_list.erase(it_peak);
189 : _precision(other._precision),
190 _peak_ion_match_list(other._peak_ion_match_list)
200std::vector<DataPoint>::iterator
202 std::vector<DataPoint> &peak_list,
206 std::vector<DataPoint>::iterator itpeak = peak_list.begin();
207 std::vector<DataPoint>::iterator itend = peak_list.end();
208 std::vector<DataPoint>::iterator itselect = peak_list.end();
212 while(itpeak != itend)
217 if(itpeak->y > best_intensity)
219 best_intensity = itpeak->y;
229const std::list<PeakIonIsotopeMatch> &
258 if(
a.getPeptideIonType() <
b.getPeptideIonType())
260 if(
a.getPeptideFragmentIonSp().get()->size() <
261 b.getPeptideFragmentIonSp().get()->size())
263 if(
a.getCharge() <
b.getCharge())
265 if(
a.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() <
266 b.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
271 std::size_t nserie = 0;
272 std::size_t isotopeserie = 0;
273 unsigned int charge = 0;
274 for(std::list<PeakIonIsotopeMatch>::iterator it =
279 if((nserie != it->getPeptideFragmentIonSp().get()->size()) ||
280 (ion_type != it->getPeptideIonType()) || (charge != it->getCharge()))
282 ion_type = it->getPeptideIonType();
284 nserie = it->getPeptideFragmentIonSp().get()->size();
285 charge = it->getCharge();
288 it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
291 it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
Class to represent a mass spectrum.
virtual const QString & qwhat() const
const std::list< PeptideFragmentIonSp > getPeptideFragmentIonSp(PeptideIon ion_type) const
unsigned int size() const
virtual ~PeptideIsotopeSpectrumMatch()
std::list< PeakIonIsotopeMatch >::const_iterator const_iterator
std::list< PeakIonIsotopeMatch > _peak_ion_match_list
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
const std::list< PeakIonIsotopeMatch > & getPeakIonIsotopeMatchList() const
const_iterator begin() const
void dropPeaksLackingMonoisotope()
const_iterator end() const
virtual std::vector< DataPoint >::iterator getBestPeakIterator(std::vector< DataPoint > &peak_list, const PeptideNaturalIsotopeAverage &ion) const
virtual QString toString() const
pappso_double getMz() const
virtual bool matchPeak(pappso_double peak_mz) const final
PeptideNaturalIsotopeAverageSp makePeptideNaturalIsotopeAverageSp() const
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
std::shared_ptr< const Peptide > PeptideSp
double pappso_double
A type definition for doubles.