OpenMS
Loading...
Searching...
No Matches
SimpleSearchEngineAlgorithm.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: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
11
16
17#include <vector>
18
19namespace OpenMS
20{
21
22class OPENMS_DLLAPI SimpleSearchEngineAlgorithm :
24 public ProgressLogger
25{
26 public:
28
30 enum class ExitCodes
31 {
32 EXECUTION_OK,
33 INPUT_FILE_EMPTY,
34 UNEXPECTED_RESULT,
35 UNKNOWN_ERROR,
36 ILLEGAL_PARAMETERS
37 };
38
40 ExitCodes search(const String& in_mzML,
41 const String& in_db,
42 std::vector<ProteinIdentification>& prot_ids,
43 PeptideIdentificationList& pep_ids) const;
44 protected:
45 void updateMembers_() override;
46
49 {
52 double score = 0;
53 double prefix_fraction = 0;
54 double suffix_fraction = 0;
55 double mean_error = 0.0;
56 int isotope_error = 0;
57 std::vector<PeptideHit::PeakAnnotation> fragment_annotations;
58
59 static bool hasBetterScore(const AnnotatedHit_& a, const AnnotatedHit_& b)
60 {
61 if (a.score != b.score) return a.score > b.score;
62 // compare the mod_index first, as it is cheaper than the strncmp() of the sequences
63 // there doesn't have to be a certain ordering (that makes sense), we just need it to be thread-safe
65 return a.sequence < b.sequence;
66 }
67 };
68
70 static void preprocessSpectra_(PeakMap& exp, double fragment_mass_tolerance, bool fragment_mass_tolerance_unit_ppm);
71
74 void postProcessHits_(const PeakMap& exp,
75 std::vector<std::vector<SimpleSearchEngineAlgorithm::AnnotatedHit_> >& annotated_hits,
76 std::vector<ProteinIdentification>& protein_ids,
77 PeptideIdentificationList& peptide_ids,
78 Size top_hits,
79 const ModifiedPeptideGenerator::MapToResidueType& fixed_modifications,
80 const ModifiedPeptideGenerator::MapToResidueType& variable_modifications,
81 Size max_variable_mods_per_peptide,
82 const StringList& modifications_fixed,
83 const StringList& modifications_variable,
84 Int peptide_missed_cleavages,
85 double precursor_mass_tolerance,
86 double fragment_mass_tolerance,
87 const String& precursor_mass_tolerance_unit_ppm,
88 const String& fragment_mass_tolerance_unit_ppm,
89 const Int precursor_min_charge,
90 const Int precursor_max_charge,
91 const String& enzyme,
92 const String& database_name) const;
93
96
99
101
103
105
107
109
111
113
115
117
121
123
125};
126
127} // namespace
128
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
Definition ModifiedPeptideGenerator.h:31
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
Base class for all classes that want to report their progress.
Definition ProgressLogger.h:27
Definition SimpleSearchEngineAlgorithm.h:25
static void preprocessSpectra_(PeakMap &exp, double fragment_mass_tolerance, bool fragment_mass_tolerance_unit_ppm)
filter, deisotope, decharge spectra
Size peptide_max_size_
Definition SimpleSearchEngineAlgorithm.h:119
void postProcessHits_(const PeakMap &exp, std::vector< std::vector< SimpleSearchEngineAlgorithm::AnnotatedHit_ > > &annotated_hits, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, Size top_hits, const ModifiedPeptideGenerator::MapToResidueType &fixed_modifications, const ModifiedPeptideGenerator::MapToResidueType &variable_modifications, Size max_variable_mods_per_peptide, const StringList &modifications_fixed, const StringList &modifications_variable, Int peptide_missed_cleavages, double precursor_mass_tolerance, double fragment_mass_tolerance, const String &precursor_mass_tolerance_unit_ppm, const String &fragment_mass_tolerance_unit_ppm, const Int precursor_min_charge, const Int precursor_max_charge, const String &enzyme, const String &database_name) const
filter and annotate search results most of the parameters are used to properly add meta data to the i...
Size precursor_max_charge_
Definition SimpleSearchEngineAlgorithm.h:98
Size precursor_min_charge_
Definition SimpleSearchEngineAlgorithm.h:97
Size report_top_hits_
Definition SimpleSearchEngineAlgorithm.h:124
Size modifications_max_variable_mods_per_peptide_
Definition SimpleSearchEngineAlgorithm.h:110
String precursor_mass_tolerance_unit_
Definition SimpleSearchEngineAlgorithm.h:95
StringList modifications_fixed_
Definition SimpleSearchEngineAlgorithm.h:106
String enzyme_
Definition SimpleSearchEngineAlgorithm.h:112
Size peptide_min_size_
Definition SimpleSearchEngineAlgorithm.h:118
String fragment_mass_tolerance_unit_
Definition SimpleSearchEngineAlgorithm.h:104
IntList precursor_isotopes_
Definition SimpleSearchEngineAlgorithm.h:100
bool decoys_
Definition SimpleSearchEngineAlgorithm.h:114
StringList annotate_psm_
Definition SimpleSearchEngineAlgorithm.h:116
ExitCodes search(const String &in_mzML, const String &in_db, std::vector< ProteinIdentification > &prot_ids, PeptideIdentificationList &pep_ids) const
search spectra against database
double precursor_mass_tolerance_
Definition SimpleSearchEngineAlgorithm.h:94
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
ExitCodes
Exit codes.
Definition SimpleSearchEngineAlgorithm.h:31
StringList modifications_variable_
Definition SimpleSearchEngineAlgorithm.h:108
double fragment_mass_tolerance_
Definition SimpleSearchEngineAlgorithm.h:102
String peptide_motif_
Definition SimpleSearchEngineAlgorithm.h:122
Size peptide_missed_cleavages_
Definition SimpleSearchEngineAlgorithm.h:120
StringView provides a non-owning view on an existing string.
Definition StringView.h:30
A more convenient string class.
Definition String.h:34
int Int
Signed integer type.
Definition Types.h:72
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition Types.h:104
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< Int > IntList
Vector of signed integers.
Definition ListUtils.h:29
std::vector< String > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Slimmer structure as storing all scored candidates in PeptideHit objects takes too much space.
Definition SimpleSearchEngineAlgorithm.h:49
static bool hasBetterScore(const AnnotatedHit_ &a, const AnnotatedHit_ &b)
Definition SimpleSearchEngineAlgorithm.h:59
double score
main score
Definition SimpleSearchEngineAlgorithm.h:52
StringView sequence
Definition SimpleSearchEngineAlgorithm.h:50
std::vector< PeptideHit::PeakAnnotation > fragment_annotations
Definition SimpleSearchEngineAlgorithm.h:57
SignedSize peptide_mod_index
enumeration index of the non-RNA peptide modification
Definition SimpleSearchEngineAlgorithm.h:51