45 std::make_shared<FilterResampleKeepGreater>(minimumMz);
60 unsigned int parent_charge)
70 std::make_shared<PeptideIsotopeSpectrumMatch>(spectrum,
82 qDebug() <<
" accumulate";
83 std::vector<double> delta_list;
100 delta_list.push_back(
101 peak_ion.getPeptideFragmentIonSp().get()->getMz(peak_ion.getCharge()) -
102 peak_ion.getPeak().x);
105 std::accumulate(delta_list.begin(), delta_list.end(), 0);
107 qDebug() <<
" delta_list.size()=" << delta_list.size();
111 if(delta_list.size() > 0)
115 std::sort(delta_list.begin(), delta_list.end());
141 if(peak_ion_match.getPeptideIonType() == ion_type)
143 sum += peak_ion_match.getPeak().y;
154 sum += peak_ion_match.getPeak().y;
168 return m_peakIonPairs.size();
172 std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch>> &
175 return m_peakIonPairs;
183 for(
auto &peak_pairs : m_peakIonPairs)
185 sum += peak_pairs.first.getPeak().y;
186 sum += peak_pairs.second.getPeak().y;
194 return m_matchedMzDiffSd;
200 return m_matchedMzDiffMean;
207 return msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList().size();
214 auto peak_ion_match_list =
215 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList();
217 peak_ion_match_list.erase(
219 peak_ion_match_list.begin(),
220 peak_ion_match_list.end(),
222 if(a.getPeptideIonType() != ion_type)
224 if(a.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() > 0)
228 peak_ion_match_list.end());
230 peak_ion_match_list.sort(
232 if(
a.getCharge() <
b.getCharge())
234 if(
a.getPeptideIonType() <
b.getPeptideIonType())
236 if(
a.getPeptideFragmentIonSp().get()->size() <
237 b.getPeptideFragmentIonSp().get()->size())
242 unsigned int charge = 0;
243 std::size_t size = 0;
244 std::size_t count = 0;
245 for(std::list<PeakIonIsotopeMatch>::iterator it = peak_ion_match_list.begin();
246 it != peak_ion_match_list.end();
250 << it->toString() <<
max <<
" " << it->getPeak().x <<
" "
251 << it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
253 if((charge != it->getCharge()) ||
254 (size != (it->getPeptideFragmentIonSp().get()->size() - 1)))
257 charge = it->getCharge();
262 size = it->getPeptideFragmentIonSp().get()->size();
271 std::vector<bool> covered;
272 covered.resize(msp_peptide.get()->size(),
false);
274 for(
auto &peak : msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList())
276 if(peak.getPeptideIonType() == ion_type)
278 covered[peak.getPeptideFragmentIonSp().get()->size() - 1] =
true;
281 return std::count(covered.begin(), covered.end(),
true);
288 std::vector<bool> covered;
289 covered.resize(msp_peptide.get()->size(),
false);
291 for(
auto &peak_pair : m_peakIonPairs)
294 peak_pair.first.getPeptideFragmentIonSp().get()->size() - 1;
296 covered[pos + 1] =
true;
298 return std::count(covered.begin(), covered.end(),
true);
306 std::list<pappso::PeakIonIsotopeMatch> peak_ion_type =
307 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList();
310 return (
a.getPeptideIonType() != ion_type);
312 auto peak_it = std::max_element(
313 peak_ion_type.begin(),
316 return (a.getPeak().y < b.getPeak().y);
319 if(peak_it == peak_ion_type.end())
321 return peak_it->getPeak().y;
328 auto peak_it = std::max_element(
329 m_peakIonPairs.begin(),
330 m_peakIonPairs.end(),
331 [](
const std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch>
333 const std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch>
335 return ((a.first.getPeak().y + a.second.getPeak().y) <
336 (b.first.getPeak().y + b.second.getPeak().y));
339 if(peak_it == m_peakIonPairs.end())
342 return getIonPairPrecursorMassDelta(*peak_it);
347 const std::pair<pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch>
350 qDebug() << m_precursorTheoreticalMz <<
" " << ion_pair.first.getPeak().x
351 <<
" " << ion_pair.second.getPeak().x <<
" "
352 << ion_pair.second.getCharge() <<
" " << ion_pair.first.getCharge()
353 <<
" " << m_parentCharge;
355 (m_precursorTheoreticalMass + (
MHPLUS * ion_pair.first.getCharge())) /
356 ion_pair.first.getCharge();
359 return (diff - (ion_pair.first.getPeak().x + ion_pair.second.getPeak().x -
360 ((
MHPLUS * ion_pair.first.getCharge())) /
361 ion_pair.first.getCharge()));
368 std::size_t peptide_size = peptideSp.get()->size();
369 std::vector<PeakIonIsotopeMatch> ion_isotope_list(
370 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList().begin(),
371 msp_peptideSpectrumMatch.get()->getPeakIonIsotopeMatchList().end());
377 ion_isotope_list.end(),
380 if(it != ion_isotope_list.end())
382 m_peakIonPairs.push_back({peak_ion_ext, *it});
Class to represent a mass spectrum.
static PrecisionPtr getPrecisionPtrFractionInstance(PrecisionPtr origin, double fraction)
get the fraction of an existing precision pointer
std::size_t getNumberOfMatchedIons() const
number of matched ions (peaks)
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
std::vector< std::pair< pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch > > m_peakIonPairs
std::shared_ptr< FilterChargeDeconvolution > msp_filterChargeDeconvolution
void setPeptideSpectrumCharge(const pappso::PeptideSp peptideSp, const MassSpectrum *p_spectrum, unsigned int parent_charge)
const std::vector< std::pair< pappso::PeakIonIsotopeMatch, pappso::PeakIonIsotopeMatch > > & getPeakIonPairs() const
std::shared_ptr< FilterResampleKeepGreater > msp_filterKeepGreater
std::shared_ptr< FilterMzExclusion > msp_filterMzExclusion
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
unsigned int m_parentCharge
double getMaxIntensityPeakIonMatch(PeptideIon ion_type) const
std::list< PeptideIon > m_ionList
double m_matchedMzDiffMedian
std::shared_ptr< PeptideIsotopeSpectrumMatch > msp_peptideSpectrumMatch
std::size_t getMaxConsecutiveIon(PeptideIon ion_type)
get the maximum consecutive fragments of one ion type
PrecisionPtr m_ms2precision
double getIntensityOfMatchedIon(PeptideIon ion_type)
get the sum of intensity of a specific ion
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
std::size_t getAaSequenceCoverage(PeptideIon ion_type)
number of amino acid covered by matched ions
pappso_double sumY() 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
const pappso_double MHPLUS(1.007276466879)
double pappso_double
A type definition for doubles.
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...
bool peptideIonIsNter(PeptideIon ion_type)
tells if an ion is Nter
@ max
maximum of intensities
comutes various PSM (Peptide Spectrum Match) features