34 unsigned int parent_charge,
36 const std::list<Enums::PeptideIon> &ion_type_list_in,
37 unsigned int max_isotope_number,
38 [[maybe_unused]]
unsigned int max_isotope_rank)
45 qDebug() <<
"peptideSp.get()->getSequence()=" << peptideSp.get()->getSequence()
46 <<
" max_isotope_number=" << max_isotope_number
47 <<
" spectrum.size=" << spectrum.size() <<
" parent_charge=" << parent_charge
48 <<
" ion_type_list.size=" << ion_type_list_in.size()
49 <<
" max_isotope_rank=" << max_isotope_rank;
51 std::list<Enums::PeptideIon> ion_type_list(ion_type_list_in);
65 qDebug() <<
" fragmentIonList.size()=" << fragmentIonList.
size();
66 std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
67 for(
auto ion_type : ion_type_list)
69 const std::list<PeptideFragmentIonSp> peptide_fragment_ion_list =
71 qDebug() <<
" peptide_fragment_ion_list.size()=" << peptide_fragment_ion_list.size();
73 for(
unsigned int charge = 1; charge <= parent_charge; charge++)
76 for(
auto &&peptide_fragment_ion : peptide_fragment_ion_list)
78 qDebug() <<
"peptide_fragment_ion.get()->getMz(charge)="
79 << peptide_fragment_ion.get()->getMz(charge);
81 for(
unsigned int isotope_number = 0; isotope_number <= max_isotope_number;
86 if(max_isotope_rank == 0)
90 peptide_fragment_ion, isotope_number, charge, precision);
95 isotope_list, max_isotope_rank, isotope_number, charge, precision);
98 qDebug() <<
"max_isotope_rank=" << max_isotope_rank
99 <<
" isotope_number=" << isotope_number <<
" charge=" << charge
100 <<
" precision=" << precision
101 <<
" p_isotopeIon->getMz()=" << p_isotopeIon->
getMz() <<
" "
102 << isotope_number <<
" " << p_isotopeIon->
toString();
104 std::vector<DataPoint>::iterator it_peak =
106 if(it_peak != peak_list.end())
111 peptide_fragment_ion));
112 peak_list.erase(it_peak);
126 QObject::tr(
"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)
136 QObject::tr(
"ERROR building PeptideIsotopeSpectrumMatch, std exception:\n%1")
137 .arg(exception_std.what());
138 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
149 std::vector<PeptideNaturalIsotopeAverageSp> v_peptideIsotopeList,
150 std::vector<PeptideFragmentIonSp> v_peptideIonList,
154 qDebug() <<
" begin";
155 if(v_peptideIsotopeList.size() != v_peptideIonList.size())
158 QObject::tr(
"v_peptideIsotopeList.size() %1 != v_peptideIonList.size() %2")
159 .arg(v_peptideIsotopeList.size())
160 .arg(v_peptideIonList.size()));
163 auto isotopeIt = v_peptideIsotopeList.begin();
164 auto ionIt = v_peptideIonList.begin();
165 std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
167 while(isotopeIt != v_peptideIsotopeList.end())
169 std::vector<DataPoint>::iterator it_peak =
171 if(it_peak != peak_list.end())
174 peak_list.erase(it_peak);
199 std::vector<DataPoint>::iterator itpeak = peak_list.begin();
200 std::vector<DataPoint>::iterator itend = peak_list.end();
201 std::vector<DataPoint>::iterator itselect = peak_list.end();
205 while(itpeak != itend)
210 if(itpeak->y > best_intensity)
212 best_intensity = itpeak->y;
250 if(
a.getPeptideIonType() <
b.getPeptideIonType())
252 if(
a.getPeptideFragmentIonSp().get()->size() <
b.getPeptideFragmentIonSp().get()->size())
254 if(
a.getCharge() <
b.getCharge())
256 if(
a.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() <
257 b.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
262 std::size_t nserie = 0;
263 std::size_t isotopeserie = 0;
264 unsigned int charge = 0;
269 if((nserie != it->getPeptideFragmentIonSp().get()->size()) ||
270 (ion_type != it->getPeptideIonType()) || (charge != it->getCharge()))
272 ion_type = it->getPeptideIonType();
274 nserie = it->getPeptideFragmentIonSp().get()->size();
275 charge = it->getCharge();
277 if(isotopeserie <= it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
279 isotopeserie = it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
PeptideIsotopeSpectrumMatch(const MassSpectrum &spectrum, const PeptideSp &peptide_sp, unsigned int parent_charge, PrecisionPtr precision, const std::list< Enums::PeptideIon > &ion_type_list, unsigned int max_isotope_number, unsigned int max_isotope_rank)
annotate spectrum with peptide ions and isotopes