| OpenMS 2.5.0

SimpleSearchEngineAlgorithm.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: Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34
35 #include <OpenMS/CONCEPT/ProgressLogger.h>
36 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
37
38 #include <OpenMS/ANALYSIS/RNPXL/ModifiedPeptideGenerator.h>
39 #include <OpenMS/KERNEL/MSExperiment.h>
40
41 #include <vector>
42
43 namespace OpenMS
44 {
45
46 class OPENMS_DLLAPI SimpleSearchEngineAlgorithm :
47 public DefaultParamHandler,
48 public ProgressLogger
49 {
50 public:
51 SimpleSearchEngineAlgorithm();
52
54 enum class ExitCodes
55 {
56 EXECUTION_OK,
57 INPUT_FILE_EMPTY,
58 UNEXPECTED_RESULT,
59 UNKNOWN_ERROR,
60 ILLEGAL_PARAMETERS
61 };
62
64 ExitCodes search(const String& in_mzML,
65 const String& in_db,
66 std::vector<ProteinIdentification>& prot_ids,
67 std::vector<PeptideIdentification>& pep_ids) const;
68 protected:
69 void updateMembers_() override;
70
72 struct AnnotatedHit_
73 {
74 StringView sequence;
75 SignedSize peptide_mod_index;
76 double score = 0;
77 std::vector<PeptideHit::PeakAnnotation> fragment_annotations;
78 static bool hasBetterScore(const AnnotatedHit_& a, const AnnotatedHit_& b)
79 {
80 return a.score > b.score;
81 }
82 };
83
85 static void preprocessSpectra_(PeakMap& exp, double fragment_mass_tolerance, bool fragment_mass_tolerance_unit_ppm);
86
89 static void postProcessHits_(const PeakMap& exp,
90 std::vector<std::vector<SimpleSearchEngineAlgorithm::AnnotatedHit_> >& annotated_hits,
91 std::vector<ProteinIdentification>& protein_ids,
92 std::vector<PeptideIdentification>& peptide_ids,
93 Size top_hits,
94 const ModifiedPeptideGenerator::MapToResidueType& fixed_modifications,
95 const ModifiedPeptideGenerator::MapToResidueType& variable_modifications,
96 Size max_variable_mods_per_peptide,
97 const StringList& modifications_fixed,
98 const StringList& modifications_variable,
99 Int peptide_missed_cleavages,
100 double precursor_mass_tolerance,
101 double fragment_mass_tolerance,
102 const String& precursor_mass_tolerance_unit_ppm,
103 const String& fragment_mass_tolerance_unit_ppm,
104 const Int precursor_min_charge,
105 const Int precursor_max_charge,
106 const String& enzyme,
107 const String& database_name);
108
109 double precursor_mass_tolerance_;
110 String precursor_mass_tolerance_unit_;
111
112 Size precursor_min_charge_;
113 Size precursor_max_charge_;
114
115 IntList precursor_isotopes_;
116
117 double fragment_mass_tolerance_;
118
119 String fragment_mass_tolerance_unit_;
120
121 StringList modifications_fixed_;
122
123 StringList modifications_variable_;
124
125 Size modifications_max_variable_mods_per_peptide_;
126
127 String enzyme_;
128
129 Size peptide_min_size_;
130 Size peptide_max_size_;
131 Size peptide_missed_cleavages_;
132
133 String peptide_motif_;
134
135 Size report_top_hits_;
136 };
137
138 } // namespace
139
OpenMS::SignedSize
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
OpenMS::SimpleSearchEngineAlgorithm::peptide_missed_cleavages_
Size peptide_missed_cleavages_
Definition: SimpleSearchEngineAlgorithm.h:131
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::IntList
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:55
OpenMS::ModifiedPeptideGenerator::MapToResidueType
Definition: ModifiedPeptideGenerator.h:58
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
OpenMS::SimpleSearchEngineAlgorithm::modifications_variable_
StringList modifications_variable_
Definition: SimpleSearchEngineAlgorithm.h:123
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::hasBetterScore
static bool hasBetterScore(const AnnotatedHit_ &a, const AnnotatedHit_ &b)
Definition: SimpleSearchEngineAlgorithm.h:78
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::SimpleSearchEngineAlgorithm::peptide_max_size_
Size peptide_max_size_
Definition: SimpleSearchEngineAlgorithm.h:130
OpenMS::SimpleSearchEngineAlgorithm::modifications_max_variable_mods_per_peptide_
Size modifications_max_variable_mods_per_peptide_
Definition: SimpleSearchEngineAlgorithm.h:125
OpenMS::SimpleSearchEngineAlgorithm::precursor_mass_tolerance_unit_
String precursor_mass_tolerance_unit_
Definition: SimpleSearchEngineAlgorithm.h:110
OpenMS::SimpleSearchEngineAlgorithm::fragment_mass_tolerance_
double fragment_mass_tolerance_
Definition: SimpleSearchEngineAlgorithm.h:117
OpenMS::StringView
StringView provides a non-owning view on an existing string.
Definition: String.h:488
ProgressLogger.h
OpenMS::SimpleSearchEngineAlgorithm::ExitCodes
ExitCodes
Exit codes.
Definition: SimpleSearchEngineAlgorithm.h:54
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
MSExperiment.h
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
OpenMS::SimpleSearchEngineAlgorithm::report_top_hits_
Size report_top_hits_
Definition: SimpleSearchEngineAlgorithm.h:135
OpenMS::SimpleSearchEngineAlgorithm::precursor_min_charge_
Size precursor_min_charge_
Definition: SimpleSearchEngineAlgorithm.h:112
DefaultParamHandler.h
OpenMS::SimpleSearchEngineAlgorithm::enzyme_
String enzyme_
Definition: SimpleSearchEngineAlgorithm.h:127
OpenMS::SimpleSearchEngineAlgorithm::peptide_min_size_
Size peptide_min_size_
Definition: SimpleSearchEngineAlgorithm.h:129
OpenMS::SimpleSearchEngineAlgorithm::fragment_mass_tolerance_unit_
String fragment_mass_tolerance_unit_
Definition: SimpleSearchEngineAlgorithm.h:119
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::peptide_mod_index
SignedSize peptide_mod_index
enumeration index of the non-RNA peptide modification
Definition: SimpleSearchEngineAlgorithm.h:75
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_
Slimmer structure as storing all scored candidates in PeptideHit objects takes too much space...
Definition: SimpleSearchEngineAlgorithm.h:72
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::sequence
StringView sequence
Definition: SimpleSearchEngineAlgorithm.h:74
ModifiedPeptideGenerator.h
OpenMS::SimpleSearchEngineAlgorithm::precursor_max_charge_
Size precursor_max_charge_
Definition: SimpleSearchEngineAlgorithm.h:113
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::score
double score
main score
Definition: SimpleSearchEngineAlgorithm.h:76
int
OpenMS::SimpleSearchEngineAlgorithm::modifications_fixed_
StringList modifications_fixed_
Definition: SimpleSearchEngineAlgorithm.h:121
OpenMS::SimpleSearchEngineAlgorithm
Definition: SimpleSearchEngineAlgorithm.h:46
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::fragment_annotations
std::vector< PeptideHit::PeakAnnotation > fragment_annotations
Definition: SimpleSearchEngineAlgorithm.h:77
OpenMS::SimpleSearchEngineAlgorithm::peptide_motif_
String peptide_motif_
Definition: SimpleSearchEngineAlgorithm.h:133
OpenMS::SimpleSearchEngineAlgorithm::precursor_isotopes_
IntList precursor_isotopes_
Definition: SimpleSearchEngineAlgorithm.h:115
OpenMS::SimpleSearchEngineAlgorithm::precursor_mass_tolerance_
double precursor_mass_tolerance_
Definition: SimpleSearchEngineAlgorithm.h:109
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127