| OpenMS 2.5.0

CompNovoIdentificationBase.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Andreas Bertsch $
33 // --------------------------------------------------------------------------
34
35
36 #pragma once
37
38 // OpenMS includes
39 #include <OpenMS/METADATA/PeptideIdentification.h>
40 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
41 #include <OpenMS/DATASTRUCTURES/Map.h>
42 #include <OpenMS/COMPARISON/SPECTRA/ZhangSimilarityScore.h>
43 #include <OpenMS/CHEMISTRY/MASSDECOMPOSITION/MassDecomposition.h>
44 #include <OpenMS/CHEMISTRY/MASSDECOMPOSITION/MassDecompositionAlgorithm.h>
45 #include <OpenMS/ANALYSIS/DENOVO/CompNovoIonScoringBase.h>
46
47 // stl includes
48 #include <vector>
49
50 namespace OpenMS
51 {
57 class OPENMS_DLLAPI CompNovoIdentificationBase :
58 public DefaultParamHandler
59 {
60
61 public:
62
66 CompNovoIdentificationBase();
68
70 CompNovoIdentificationBase(const CompNovoIdentificationBase & source);
71
73 ~CompNovoIdentificationBase() override;
75
77 CompNovoIdentificationBase & operator=(const CompNovoIdentificationBase & source);
78
82 virtual void getIdentifications(std::vector<PeptideIdentification> & ids, const PeakMap & exp) = 0;
85
86 typedef CompNovoIonScoringBase::IonScore IonScore;
87
88 protected:
89
91 void updateMembers_() override;
92
94 void filterPermuts_(std::set<String> & permut);
95
97 void selectPivotIons_(std::vector<Size> & pivots, Size left, Size right, Map<double, IonScore> & CID_nodes, const PeakSpectrum & CID_orig_spec, double precursor_weight, bool full_range = false);
98
100 void filterDecomps_(std::vector<MassDecomposition> & decomps);
101
103 void getDecompositions_(std::vector<MassDecomposition> & decomps, double mass, bool no_caching = false);
104
106 static void permute_(const String& prefix, String s, std::set<String> & permutations);
107
108 Size countMissedCleavagesTryptic_(const String & peptide) const;
109
111 void getCIDSpectrumLight_(PeakSpectrum & spec, const String & sequence, double prefix, double suffix);
112
114 void getCIDSpectrum_(PeakSpectrum & spec, const String & sequence, Size charge, double prefix = 0.0, double suffix = 0.0);
115
117 void getETDSpectrum_(PeakSpectrum & spec, const String &sequence, Size /* charge */, double prefix = 0.0, double suffix = 0.0);
118
120 void initIsotopeDistributions_();
121
123 void windowMower_(PeakSpectrum & spec, double windowsize, Size no_peaks);
124
126 double compareSpectra_(const PeakSpectrum & s1, const PeakSpectrum & s2);
127
129 AASequence getModifiedAASequence_(const String & sequence);
130
132 String getModifiedStringFromAASequence_(const AASequence & sequence);
133
135 Map<char, const Residue *> name_to_residue_;
136
138 Map<const Residue *, char> residue_to_name_;
139
141 Map<char, double> aa_to_weight_;
142
143 MassDecompositionAlgorithm mass_decomp_algorithm_;
144
145 double min_aa_weight_{};
146
147 ZhangSimilarityScore zhang_;
148
149 Map<Size, Map<Size, std::set<String> > > subspec_to_sequences_;
150
151 Size max_number_aa_per_decomp_;
152
153 bool tryptic_only_;
154
155 double fragment_mass_tolerance_;
156
157 Size max_number_pivot_;
158
159 double decomp_weights_precision_;
160
161 double max_mz_;
162
163 double min_mz_;
164
165 double max_decomp_weight_;
166
167 Size max_subscore_number_;
168
169 Size max_isotope_;
170
171 Map<double, std::vector<MassDecomposition> > decomp_cache_;
172
173 Map<String, std::set<String> > permute_cache_;
174
175 private:
177 Map<Size, std::vector<double> > isotope_distributions_;
178
179 public:
180
186 class Permut
187 {
188 private:
189
190 Permut() :
191 score_(0)
192 {
193 }
194
195 public:
196
197 Permut(const std::set<String>::const_iterator & permut, double s) :
198 permut_(permut),
199 score_(s)
200 {
201 }
202
203 Permut(const Permut & rhs) = default;
204 virtual ~Permut() = default;
205
206 Permut & operator=(const Permut & rhs)
207 {
208 if (&rhs != this)
209 {
210 permut_ = rhs.permut_;
211 score_ = rhs.score_;
212 }
213 return *this;
214 }
215
216 const std::set<String>::const_iterator & getPermut() const
217 {
218 return permut_;
219 }
220
221 void setPermut(const std::set<String>::const_iterator & it)
222 {
223 permut_ = it;
224 }
225
226 double getScore() const
227 {
228 return score_;
229 }
230
231 void setScore(double score)
232 {
233 score_ = score;
234 }
235
236 protected:
237
238 std::set<String>::const_iterator permut_;
239 double score_;
240 };
241
242 };
243
244 namespace Internal
245 {
246 bool PermutScoreComparator(const CompNovoIdentificationBase::Permut & p1, const CompNovoIdentificationBase::Permut & p2);
247 }
248 }
249
OpenMS::String
A more convenient string class.
Definition: String.h:58
CompNovoIonScoringBase.h
OpenMS::CompNovoIdentificationBase::max_mz_
double max_mz_
Definition: CompNovoIdentificationBase.h:161
OpenMS::CompNovoIdentificationBase::max_number_pivot_
Size max_number_pivot_
Definition: CompNovoIdentificationBase.h:157
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
OpenMS::CompNovoIdentificationBase::subspec_to_sequences_
Map< Size, Map< Size, std::set< String > > > subspec_to_sequences_
Definition: CompNovoIdentificationBase.h:149
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::CompNovoIdentificationBase::residue_to_name_
Map< const Residue *, char > residue_to_name_
mapping of the actual residue to the internal representing character
Definition: CompNovoIdentificationBase.h:138
OpenMS::CompNovoIdentificationBase::zhang_
ZhangSimilarityScore zhang_
Definition: CompNovoIdentificationBase.h:147
OpenMS::CompNovoIdentificationBase::mass_decomp_algorithm_
MassDecompositionAlgorithm mass_decomp_algorithm_
Definition: CompNovoIdentificationBase.h:143
OpenMS::CompNovoIdentificationBase::Permut::score_
double score_
Definition: CompNovoIdentificationBase.h:239
OpenMS::CompNovoIdentificationBase::permute_cache_
Map< String, std::set< String > > permute_cache_
Definition: CompNovoIdentificationBase.h:173
OpenMS::CompNovoIdentificationBase::max_isotope_
Size max_isotope_
Definition: CompNovoIdentificationBase.h:169
OpenMS::CompNovoIdentificationBase::Permut::permut_
std::set< String >::const_iterator permut_
Definition: CompNovoIdentificationBase.h:238
OpenMS::Internal::PermutScoreComparator
bool PermutScoreComparator(const CompNovoIdentificationBase::Permut &p1, const CompNovoIdentificationBase::Permut &p2)
OpenMS::ZhangSimilarityScore
Similarity score of Zhang.
Definition: ZhangSimilarityScore.h:54
ZhangSimilarityScore.h
OpenMS::CompNovoIdentificationBase::IonScore
CompNovoIonScoringBase::IonScore IonScore
Definition: CompNovoIdentificationBase.h:86
OpenMS::CompNovoIdentificationBase::Permut::setPermut
void setPermut(const std::set< String >::const_iterator &it)
Definition: CompNovoIdentificationBase.h:221
OpenMS::CompNovoIdentificationBase::Permut
Simple class to store permutations and a score.
Definition: CompNovoIdentificationBase.h:186
OpenMS::CompNovoIdentificationBase::Permut::getPermut
const std::set< String >::const_iterator & getPermut() const
Definition: CompNovoIdentificationBase.h:216
OpenMS::CompNovoIdentificationBase::Permut::setScore
void setScore(double score)
Definition: CompNovoIdentificationBase.h:231
OpenMS::CompNovoIdentificationBase::aa_to_weight_
Map< char, double > aa_to_weight_
masses of the amino acids
Definition: CompNovoIdentificationBase.h:141
OpenMS::AASequence
Representation of a peptide/protein sequence.
Definition: AASequence.h:113
OpenMS::MSSpectrum
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
OpenMS::CompNovoIdentificationBase::max_decomp_weight_
double max_decomp_weight_
Definition: CompNovoIdentificationBase.h:165
OpenMS::CompNovoIdentificationBase
run with CompNovoIdentificationBase
Definition: CompNovoIdentificationBase.h:57
OpenMS::CompNovoIdentificationBase::Permut::getScore
double getScore() const
Definition: CompNovoIdentificationBase.h:226
OpenMS::Map
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:50
PeptideIdentification.h
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::CompNovoIdentificationBase::max_subscore_number_
Size max_subscore_number_
Definition: CompNovoIdentificationBase.h:167
OpenMS::CompNovoIdentificationBase::decomp_cache_
Map< double, std::vector< MassDecomposition > > decomp_cache_
Definition: CompNovoIdentificationBase.h:171
OpenMS::CompNovoIdentificationBase::tryptic_only_
bool tryptic_only_
Definition: CompNovoIdentificationBase.h:153
OpenMS::CompNovoIdentificationBase::name_to_residue_
Map< char, const Residue * > name_to_residue_
mapping for the internal representation character to the actual residue
Definition: CompNovoIdentificationBase.h:135
OpenMS::CompNovoIonScoringBase::IonScore
Definition: CompNovoIonScoringBase.h:66
MassDecomposition.h
DefaultParamHandler.h
Map.h
OpenMS::MassDecompositionAlgorithm
Mass decomposition algorithm, given a mass it suggests possible compositions.
Definition: MassDecompositionAlgorithm.h:68
MassDecompositionAlgorithm.h
OpenMS::CompNovoIdentificationBase::Permut::Permut
Permut()
Definition: CompNovoIdentificationBase.h:190
OpenMS::CompNovoIdentificationBase::isotope_distributions_
Map< Size, std::vector< double > > isotope_distributions_
Definition: CompNovoIdentificationBase.h:177
OpenMS::CompNovoIdentificationBase::fragment_mass_tolerance_
double fragment_mass_tolerance_
Definition: CompNovoIdentificationBase.h:155
OpenMS::CompNovoIdentificationBase::Permut::Permut
Permut(const std::set< String >::const_iterator &permut, double s)
Definition: CompNovoIdentificationBase.h:197
OpenMS::CompNovoIdentificationBase::max_number_aa_per_decomp_
Size max_number_aa_per_decomp_
Definition: CompNovoIdentificationBase.h:151
OpenMS::CompNovoIdentificationBase::min_mz_
double min_mz_
Definition: CompNovoIdentificationBase.h:163
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
OpenMS::CompNovoIdentificationBase::decomp_weights_precision_
double decomp_weights_precision_
Definition: CompNovoIdentificationBase.h:159
OpenMS::CompNovoIdentificationBase::Permut::operator=
Permut & operator=(const Permut &rhs)
Definition: CompNovoIdentificationBase.h:206