33 unsigned int parent_charge,
35 const std::list<PeptideIon> &ion_type_list,
36 unsigned int max_isotope_number,
37 [[maybe_unused]]
unsigned int max_isotope_rank)
38 : _precision(precision)
44 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
45 "begin max_isotope_number="
46 << max_isotope_number;
48 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
49 "peak_list spectrum.size="
51 std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
52 for(
auto ion_type : ion_type_list)
56 for(
unsigned int charge = 1; charge <= parent_charge; charge++)
58 for(
auto &&ion : ion_list)
60 unsigned int askedIsotopeRank = 1;
61 for(
unsigned int isotope_number = 0;
62 isotope_number <= max_isotope_number;
66 ion, isotope_number, charge, precision);
69 << isotope_number <<
" " << isotopeIon.
toString();
71 std::vector<DataPoint>::iterator it_peak =
73 if(it_peak != peak_list.end())
79 peak_list.erase(it_peak);
81 qDebug() << isotope_number <<
" "
93 "ERROR building PeptideIsotopeSpectrumMatch, PAPPSO exception:\n%1")
94 .arg(exception_pappso.
qwhat());
95 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
100 catch(std::exception &exception_std)
104 "ERROR building PeptideIsotopeSpectrumMatch, std exception:\n%1")
105 .arg(exception_std.what());
106 qDebug() <<
"PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
115 std::vector<PeptideNaturalIsotopeAverageSp> v_peptideIsotopeList,
116 std::vector<PeptideFragmentIonSp> v_peptideIonList,
118 : _precision(precision)
120 qDebug() <<
" begin";
121 if(v_peptideIsotopeList.size() != v_peptideIonList.size())
125 "v_peptideIsotopeList.size() %1 != v_peptideIonList.size() %2")
126 .arg(v_peptideIsotopeList.size())
127 .arg(v_peptideIonList.size()));
130 auto isotopeIt = v_peptideIsotopeList.begin();
131 auto ionIt = v_peptideIonList.begin();
132 std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
134 while(isotopeIt != v_peptideIsotopeList.end())
136 std::vector<DataPoint>::iterator it_peak =
138 if(it_peak != peak_list.end())
142 peak_list.erase(it_peak);
153 : _precision(other._precision),
154 _peak_ion_match_list(other._peak_ion_match_list)
164std::vector<DataPoint>::iterator
166 std::vector<DataPoint> &peak_list,
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();
176 while(itpeak != itend)
180 if(itpeak->y > best_intensity)
182 best_intensity = itpeak->y;
192const std::list<PeakIonIsotopeMatch> &
220 if(
a.getPeptideIonType() <
b.getPeptideIonType())
222 if(
a.getPeptideFragmentIonSp().get()->size() <
223 b.getPeptideFragmentIonSp().get()->size())
225 if(
a.getCharge() <
b.getCharge())
227 if(
a.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() <
228 b.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
233 std::size_t nserie = 0;
234 std::size_t isotopeserie = 0;
235 unsigned int charge = 0;
236 for(std::list<PeakIonIsotopeMatch>::iterator it =
241 if((nserie != it->getPeptideFragmentIonSp().get()->size()) ||
242 (ion_type != it->getPeptideIonType()) || (charge != it->getCharge()))
244 ion_type = it->getPeptideIonType();
246 nserie = it->getPeptideFragmentIonSp().get()->size();
247 charge = it->getCharge();
250 it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
253 it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
Class to represent a mass spectrum.
virtual const QString & qwhat() const
const std::list< PeptideFragmentIonSp > getPeptideFragmentIonSp(PeptideIon ion_type) 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
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.