OpenMS
Loading...
Searching...
No Matches
AScore.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Petra Gutenbrunner $
6// $Authors: David Wojnar, Timo Sachsenberg, Petra Gutenbrunner $
7// --------------------------------------------------------------------------
8
9#pragma once
10
17
18#include <limits>
19#include <vector>
20
21namespace OpenMS
22{
23 class PeptideHit;
24 class AASequence;
25
37
46 class OPENMS_DLLAPI AScore: public DefaultParamHandler
47 {
48 friend struct PScore;
49
50 public:
53
55 ~AScore() override;
56
65 PeptideHit compute(const PeptideHit& hit, PeakSpectrum& real_spectrum);
66
67 protected:
68 int compareMZ_(double mz1, double mz2) const;
69
73 template <class InputIterator1, class InputIterator2, class OutputIterator>
74 OutputIterator getSpectrumDifference_(InputIterator1 first1, InputIterator1 last1,
75 InputIterator2 first2, InputIterator2 last2, OutputIterator result) const
76 {
77 while (first1 != last1 && first2 != last2)
78 {
79 double mz1 = first1->getMZ();
80 double mz2 = first2->getMZ();
81 int val = compareMZ_(mz1, mz2);
82
83 if (val == -1)
84 {
85 *result = *first1;
86 ++result;
87 ++first1;
88 }
89 else if (val == 1)
90 {
91 ++first2;
92 }
93 else // check if more ions are within the same tolerance. If so, these can not be site determining ions
94 {
95 //check mz2 until no match
96 ++first2;
97 if (first2 != last2)
98 {
99 int ret = compareMZ_(mz1, first2->getMZ());
100 while (ret == 0 && first2 != last2)
101 {
102 ++first2;
103 ret = compareMZ_(mz1, first2->getMZ());
104 }
105 }
106
107 //check mz1 until no match
108 ++first1;
109 if (first1 != last1)
110 {
111 int ret = compareMZ_(first1->getMZ(), mz2);
112 while (ret == 0 && first1 != last1)
113 {
114 ++first1;
115 ret = compareMZ_(first1->getMZ(), mz2);
116 }
117 }
118 }
119 }
120 return std::copy(first1, last1, result);
121 }
122
124 void computeSiteDeterminingIons_(const std::vector<PeakSpectrum>& th_spectra, const ProbablePhosphoSites& candidates, std::vector<PeakSpectrum>& site_determining_ions) const;
125
127 std::vector<Size> getSites_(const String& unmodified_sequence) const;
128
130 std::vector<std::vector<Size>> computePermutations_(const std::vector<Size>& sites, Int n_phosphorylation_events) const;
131
133 Size numberOfMatchedIons_(const PeakSpectrum& th, const PeakSpectrum& windows, Size depth) const;
134
136 double peptideScore_(const std::vector<double>& scores) const;
137
142 void determineHighestScoringPermutations_(const std::vector<std::vector<double>>& peptide_site_scores, std::vector<ProbablePhosphoSites>& sites, const std::vector<std::vector<Size>>& permutations, std::multimap<double, Size>& ranking) const;
143
145 double computeBaseProbability_(double ppm_reference_mz) const;
146
148 double computeCumulativeScore_(Size N, Size n, double p) const;
149
151 Size numberOfPhosphoEvents_(const String& sequence) const;
152
155
157 std::vector<PeakSpectrum> createTheoreticalSpectra_(const std::vector<std::vector<Size>>& permutations, const AASequence& seq_without_phospho) const;
158
160 std::vector<PeakSpectrum> peakPickingPerWindowsInSpectrum_(PeakSpectrum& real_spectrum) const;
161
163 std::vector<std::vector<double>> calculatePermutationPeptideScores_(std::vector<PeakSpectrum>& th_spectra, const std::vector<PeakSpectrum>& windows_top10) const;
164
166 std::multimap<double, Size> rankWeightedPermutationPeptideScores_(const std::vector<std::vector<double>>& peptide_site_scores) const;
167
169 void updateMembers_() override;
170
171 // variables:
178 };
179
180} // namespace OpenMS
Representation of a peptide/protein sequence.
Definition AASequence.h:88
Implementation of the Ascore For a given peptide sequence and its MS/MS spectrum it identifies the mo...
Definition AScore.h:47
std::multimap< double, Size > rankWeightedPermutationPeptideScores_(const std::vector< std::vector< double > > &peptide_site_scores) const
Rank weighted permutation scores ascending.
std::vector< Size > getSites_(const String &unmodified_sequence) const
return all phospho sites
std::vector< PeakSpectrum > createTheoreticalSpectra_(const std::vector< std::vector< Size > > &permutations, const AASequence &seq_without_phospho) const
Create theoretical spectra with all combinations with the number of phosphorylation events.
AScore()
Default constructor.
double computeCumulativeScore_(Size N, Size n, double p) const
Computes the cumulative binomial probabilities.
double unambiguous_score_
Score for unambiguous assignments (all sites phosphorylated)
Definition AScore.h:176
AASequence removePhosphositesFromSequence_(const String &sequence) const
Create variant of the peptide with all phosphorylations removed.
Size numberOfPhosphoEvents_(const String &sequence) const
Computes number of phospho events in a sequence.
~AScore() override
Destructor.
std::vector< PeakSpectrum > peakPickingPerWindowsInSpectrum_(PeakSpectrum &real_spectrum) const
Pick top 10 intensity peaks for each 100 Da windows.
double peptideScore_(const std::vector< double > &scores) const
Computes the peptide score according to Beausoleil et al. page 1291.
OutputIterator getSpectrumDifference_(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result) const
Definition AScore.h:74
PeptideHit compute(const PeptideHit &hit, PeakSpectrum &real_spectrum)
Computes the AScore and returns all computed phospho-sites. The saved sequences contain only phospho ...
void computeSiteDeterminingIons_(const std::vector< PeakSpectrum > &th_spectra, const ProbablePhosphoSites &candidates, std::vector< PeakSpectrum > &site_determining_ions) const
Computes the site determining_ions for the given AS and sequences in candidates.
int compareMZ_(double mz1, double mz2) const
std::vector< std::vector< Size > > computePermutations_(const std::vector< Size > &sites, Int n_phosphorylation_events) const
calculate all n_phosphorylation_events sized sets of phospho sites (all versions of the peptides with...
void updateMembers_() override
Reimplemented from DefaultParamHandler.
double fragment_mass_tolerance_
Fragment mass tolerance for spectrum comparisons.
Definition AScore.h:172
void determineHighestScoringPermutations_(const std::vector< std::vector< double > > &peptide_site_scores, std::vector< ProbablePhosphoSites > &sites, const std::vector< std::vector< Size > > &permutations, std::multimap< double, Size > &ranking) const
Finds the peptides with the highest PeptideScores and outputs all information for computing the AScor...
Size max_permutations_
Limit for number of sequence permutations that can be handled.
Definition AScore.h:175
bool fragment_tolerance_ppm_
Is fragment mass tolerance given in ppm (or Da)?
Definition AScore.h:173
double base_match_probability_
Probability of a match at a peak depth of 1.
Definition AScore.h:177
Size numberOfMatchedIons_(const PeakSpectrum &th, const PeakSpectrum &windows, Size depth) const
Computes number of matched ions between windows and the given spectrum. All spectra have to be sorted...
Size max_peptide_length_
Limit for peptide lengths that can be analyzed.
Definition AScore.h:174
std::vector< std::vector< double > > calculatePermutationPeptideScores_(std::vector< PeakSpectrum > &th_spectra, const std::vector< PeakSpectrum > &windows_top10) const
Create 10 scores for each theoretical spectrum (permutation), according to Beausoleil et al....
double computeBaseProbability_(double ppm_reference_mz) const
Computes probability for a peak depth of one given spectra and mass_tolerance variables.
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
Represents a single spectrum match (candidate) for a specific tandem mass spectrum (MS/MS).
Definition PeptideHit.h:52
A more convenient string class.
Definition String.h:34
int Int
Signed integer type.
Definition Types.h:72
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Size peak_depth
filtering level that gave rise to maximum discriminatory score
Definition AScore.h:34
Size seq_2
index of permutation with site in unphosphorylated state
Definition AScore.h:33
Size seq_1
index of best permutation with site in phosphorylated state
Definition AScore.h:32
Size first
Definition AScore.h:30
Size AScore
Definition AScore.h:35
Size second
Definition AScore.h:31
Definition AScore.h:27
Implementation of the PScore PSM scoring algorithm.
Definition PScore.h:24