59 unsigned int parent_charge,
60 unsigned int max_isotope_number)
76 qDebug() <<
" accumulate";
77 std::vector<double> delta_list;
94 delta_list.push_back(peak_ion.getPeptideFragmentIonSp().get()->getMz(peak_ion.getCharge()) -
95 peak_ion.getPeak().x);
99 qDebug() <<
" delta_list.size()=" << delta_list.size();
103 if(delta_list.size() > 0)
107 std::sort(delta_list.begin(), delta_list.end());
133 if(peak_ion_match.getPeptideIonType() == ion_type)
135 sum += peak_ion_match.getPeak().y;
146 sum += peak_ion_match.getPeak().y;
160 return m_peakIonPairs.size();
163const std::vector<std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch>> &
166 return m_peakIonPairs;
174 for(
auto &peak_pairs : m_peakIonPairs)
176 sum += peak_pairs.first.getPeak().y;
177 sum += peak_pairs.second.getPeak().y;
185 return m_matchedMzDiffSd;
191 return m_matchedMzDiffMean;
198 return msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList().size();
205 auto peak_ion_match_list = msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList();
207 peak_ion_match_list.erase(
208 std::remove_if(peak_ion_match_list.begin(),
209 peak_ion_match_list.end(),
211 if(a.getPeptideIonType() != ion_type)
213 if(a.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() > 0)
217 peak_ion_match_list.end());
220 if(
a.getCharge() <
b.getCharge())
222 if(
a.getPeptideIonType() <
b.getPeptideIonType())
224 if(
a.getPeptideFragmentIonSp().get()->size() <
b.getPeptideFragmentIonSp().get()->size())
229 unsigned int charge = 0;
230 std::size_t size = 0;
231 std::size_t count = 0;
232 for(std::list<PeakIonIsotopeMatch>::iterator it = peak_ion_match_list.begin();
233 it != peak_ion_match_list.end();
236 qDebug() << it->toString() << max <<
" " << it->getPeak().x <<
" "
237 << it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
239 if((charge != it->getCharge()) || (size != (it->getPeptideFragmentIonSp().get()->size() - 1)))
242 charge = it->getCharge();
247 size = it->getPeptideFragmentIonSp().get()->size();
256 std::vector<bool> covered;
257 covered.resize(msp_peptide.get()->size(),
false);
259 for(
auto &peak : msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList())
261 if(peak.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() == 0)
263 if(peak.getPeptideIonType() == ion_type)
265 covered[peak.getPeptideFragmentIonSp().get()->size() - 1] =
true;
269 return std::count(covered.begin(), covered.end(),
true);
276 std::vector<bool> covered;
277 covered.resize(msp_peptide.get()->size(),
false);
279 for(
auto &peak_pair : m_peakIonPairs)
281 std::size_t pos = peak_pair.first.getPeptideFragmentIonSp().get()->size() - 1;
283 covered[pos + 1] =
true;
285 return std::count(covered.begin(), covered.end(),
true);
292 std::list<pappso::PeakIonIsotopeMatch> peak_ion_type =
293 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList();
295 peak_ion_type.remove_if(
297 auto peak_it = std::max_element(peak_ion_type.begin(),
300 return (a.getPeak().y < b.getPeak().y);
303 if(peak_it == peak_ion_type.end())
305 return peak_it->getPeak().y;
311 auto peak_it = std::max_element(
312 m_peakIonPairs.begin(),
313 m_peakIonPairs.end(),
314 [](
const std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch> &
a,
315 const std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch> &
b) {
316 return ((a.first.getPeak().y + a.second.getPeak().y) <
317 (b.first.getPeak().y + b.second.getPeak().y));
320 if(peak_it == m_peakIonPairs.end())
323 return getIonPairPrecursorMassDelta(*peak_it);
328 const std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch> &ion_pair)
const
330 qDebug() << m_precursorTheoreticalMz <<
" " << ion_pair.first.getPeak().x <<
" "
331 << ion_pair.second.getPeak().x <<
" " << ion_pair.second.getCharge() <<
" "
332 << ion_pair.first.getCharge() <<
" " << m_parentCharge;
333 double diff = (m_precursorTheoreticalMass + (
MHPLUS * ion_pair.first.getCharge())) /
334 ion_pair.first.getCharge();
337 return (diff - (ion_pair.first.getPeak().x + ion_pair.second.getPeak().x -
338 ((
MHPLUS * ion_pair.first.getCharge())) / ion_pair.first.getCharge()));
345 std::size_t peptide_size = peptideSp.get()->size();
346 std::vector<PeakIonIsotopeMatch> ion_isotope_list(
347 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList().begin(),
348 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList().end());
354 ion_isotope_list.begin(), ion_isotope_list.end(), peak_ion_ext, peptide_size);
355 if(it != ion_isotope_list.end())
357 m_peakIonPairs.push_back({peak_ion_ext, *it});
367 std::size_t peptide_size = msp_peptide.get()->size();
368 std::vector<PeakIonIsotopeMatch> ion_isotope_list(
369 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList().begin(),
370 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList().end());
376 std::vector<double> mono_th_intensities(peptide_size, 0);
377 std::vector<double> isotope_th_intensities(peptide_size, 0);
379 std::vector<double> mono_exp_intensities(peptide_size, 0);
380 std::vector<double> isotope_exp_intensities(peptide_size, 0);
383 if(peak_ion_match.getPeptideIonType() == ion_type)
385 std::size_t vector_position =
386 peak_ion_match.getPeptideFragmentIonSp().get()->size() - 1;
388 peak_ion_match.getPeptideNaturalIsotopeAverageSp();
389 if(iso_average_sp.get()->getIsotopeNumber() == 0)
391 mono_th_intensities[vector_position] = iso_average_sp.get()->getIntensityRatio();
392 mono_exp_intensities[vector_position] = peak_ion_match.getPeak().y;
394 else if(iso_average_sp.get()->getIsotopeNumber() == 1)
396 isotope_th_intensities[vector_position] =
397 iso_average_sp.get()->getIntensityRatio();
398 isotope_exp_intensities[vector_position] = peak_ion_match.getPeak().y;
403 for(std::size_t i = 0; i < mono_th_intensities.size(); i++)
405 if((mono_th_intensities[i] != 0) && (isotope_th_intensities[i] != 0))
407 DataPoint xy(mono_th_intensities[i] / isotope_th_intensities[i],
408 mono_exp_intensities[i] / isotope_exp_intensities[i]);
409 scaterplot.push_back(xy);
418 return linear_regression;
Class to represent a mass spectrum.
double getMaxIntensityPeakIonMatch(Enums::PeptideIon ion_type) const
double getIntensityOfMatchedIon(Enums::PeptideIon ion_type)
get the sum of intensity of a specific ion
std::size_t getNumberOfMatchedIons() const
number of matched ions (peaks)
std::size_t getAaSequenceCoverage(Enums::PeptideIon ion_type)
number of amino acid covered by matched ions
void findComplementIonPairs(const pappso::PeptideSp &peptideSp)
double getTotalIntensity() const
sum of all peak intensities (matched or not)
double getMatchedMzDiffMean() const
get mean deviation of matched peak mass delta
double getTotalIntensityOfMatchedIonComplementPairs() const
intensity of matched ion complement
const std::vector< std::pair< pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch > > & getPeakIonPairs() const
std::vector< std::pair< pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch > > m_peakIonPairs
std::shared_ptr< FilterResampleKeepGreater > msp_filterKeepGreater
double getIonPairPrecursorMassDelta(const std::pair< pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch > &ion_pair) const
double m_precursorTheoreticalMz
double getMaxIntensityMatchedIonComplementPairPrecursorMassDelta() const
get the precursor mass delta of the maximum intensity pair of complement ions
std::size_t countMatchedIonComplementPairs() const
count the number of matched ion complement
std::size_t getComplementPairsAaSequenceCoverage()
number of amino acid covered by matched complement pairs of ions
double m_matchedMzDiffMean
double getTotalIntensityOfMatchedIons() const
sum of matched peak intensities
std::size_t getMaxConsecutiveIon(Enums::PeptideIon ion_type)
get the maximum consecutive fragments of one ion type
LinearRegression getIonIsotopeLinearRegression() const
unsigned int m_parentCharge
double m_matchedMzDiffMedian
std::list< Enums::PeptideIon > m_ionList
std::shared_ptr< PeptideIsotopeSpectrumMatch > msp_peptideSpectrumMatch
void setPeptideSpectrumCharge(const pappso::PeptideSp peptideSp, const MassSpectrum *p_spectrum, unsigned int parent_charge, unsigned int max_isotope_number)
PrecisionPtr m_ms2precision
pappso::PeptideSp msp_peptide
double m_precursorTheoreticalMass
PsmFeatures(PrecisionPtr ms2precision, double minimumMz)
compute psm features
double getMatchedMzDiffSd() const
get standard deviation of matched peak mass delta
double m_spectrumSumIntensity
A simple container of DataPoint instances.
pappso_double sumY() const
void sortX(Enums::SortOrder sort_order=Enums::SortOrder::ascending)
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter)
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< const Peptide > PeptideSp
const pappso_double MHPLUS(1.007276466879)
double pappso_double
A type definition for doubles.
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
bool peptideIonIsNter(Enums::PeptideIon ion_type)
tells if an ion is Nter
std::vector< PeakIonIsotopeMatch >::iterator findComplementIonType(std::vector< PeakIonIsotopeMatch >::iterator begin, std::vector< PeakIonIsotopeMatch >::iterator end, const PeakIonIsotopeMatch &peak_ion, std::size_t peptide_size)
find the first element containing the complementary ion complementary ion of y1 is b(n-1) for instanc...