31 const MassSpectrum &spectrum,
33 unsigned int parent_charge,
35 std::list<PeptideIon> ion_type_list,
36 unsigned int max_isotope_number,
37 [[maybe_unused]]
unsigned int max_isotope_rank)
38 : _precision(precision)
43 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
44 "begin max_isotope_number="
45 << max_isotope_number;
46 PeptideFragmentIonListBase fragmentIonList(peptideSp, ion_type_list);
47 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
48 "peak_list spectrum.size="
50 std::list<DataPoint> peak_list(spectrum.begin(), spectrum.end());
52 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
54 for(
auto ion_type : ion_type_list)
56 auto ion_list = fragmentIonList.getPeptideFragmentIonSp(ion_type);
57 qDebug() <<
"PeptideIsotopeSpectrumMatch::"
58 "PeptideIsotopeSpectrumMatch fragmentIonList";
60 for(
unsigned int charge = 1; charge <= parent_charge; charge++)
62 for(
auto &&ion : ion_list)
64 unsigned int askedIsotopeRank = 1;
65 for(
unsigned int isotope_number = 0;
66 isotope_number <= max_isotope_number;
69 PeptideNaturalIsotopeAverage isotopeIon(ion,
75 std::list<DataPoint>::iterator it_peak =
76 getBestPeakIterator(peak_list, isotopeIon);
77 if(it_peak != peak_list.end())
79 _peak_ion_match_list.push_back(PeakIonIsotopeMatch(
81 isotopeIon.makePeptideNaturalIsotopeAverageSp(),
83 peak_list.erase(it_peak);
90 <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch end";
92 catch(PappsoException &exception_pappso)
96 "ERROR building PeptideIsotopeSpectrumMatch, PAPPSO exception:\n%1")
97 .arg(exception_pappso.qwhat());
98 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
101 throw PappsoException(errorStr);
103 catch(std::exception &exception_std)
107 "ERROR building PeptideIsotopeSpectrumMatch, std exception:\n%1")
108 .arg(exception_std.what());
109 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
112 throw PappsoException(errorStr);
116 PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch(
118 std::vector<PeptideNaturalIsotopeAverageSp> v_peptideIsotopeList,
119 std::vector<PeptideFragmentIonSp> v_peptideIonList,
121 : _precision(precision)
123 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch begin";
124 if(v_peptideIsotopeList.size() != v_peptideIonList.size())
128 "v_peptideIsotopeList.size() %1 != v_peptideIonList.size() %2")
129 .arg(v_peptideIsotopeList.size())
130 .arg(v_peptideIonList.size()));
133 auto isotopeIt = v_peptideIsotopeList.begin();
134 auto ionIt = v_peptideIonList.begin();
135 std::list<DataPoint> peak_list(spectrum.begin(), spectrum.end());
137 while(isotopeIt != v_peptideIsotopeList.end())
139 std::list<DataPoint>::iterator it_peak =
141 if(it_peak != peak_list.end())
145 peak_list.erase(it_peak);
150 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch end";
156 : _precision(other._precision),
157 _peak_ion_match_list(other._peak_ion_match_list)
166 std::list<DataPoint>::iterator
168 std::list<DataPoint> &peak_list,
172 std::list<DataPoint>::iterator itpeak = peak_list.begin();
173 std::list<DataPoint>::iterator itend = peak_list.end();
174 std::list<DataPoint>::iterator itselect = peak_list.end();
178 while(itpeak != itend)
182 if(itpeak->y > best_intensity)
184 best_intensity = itpeak->y;
194 const std::list<PeakIonIsotopeMatch> &
Class to represent a mass spectrum.
~PeptideIsotopeSpectrumMatch()
PeptideIsotopeSpectrumMatch(const MassSpectrum &spectrum, const PeptideSp &peptide_sp, unsigned int parent_charge, PrecisionPtr precision, std::list< PeptideIon > ion_list, unsigned int max_isotope_number, unsigned int max_isotope_rank)
annotate spectrum with peptide ions and isotopes
std::list< PeakIonIsotopeMatch > _peak_ion_match_list
virtual std::list< DataPoint >::iterator getBestPeakIterator(std::list< DataPoint > &peak_list, const PeptideNaturalIsotopeAverage &ion) const
const std::list< PeakIonIsotopeMatch > & getPeakIonIsotopeMatchList() const
virtual bool matchPeak(pappso_double peak_mz) const final
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< const Peptide > PeptideSp
double pappso_double
A type definition for doubles.
const PrecisionBase * PrecisionPtr