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 
37 
40 
41 #include <vector>
42 
43 namespace OpenMS
44 {
45 
46 class OPENMS_DLLAPI SimpleSearchEngineAlgorithm :
47  public DefaultParamHandler,
48  public ProgressLogger
49 {
50  public:
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 
73  {
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 
111 
114 
116 
118 
120 
122 
124 
126 
128 
132 
134 
136 };
137 
138 } // namespace
139 
DefaultParamHandler.h
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::fragment_annotations
std::vector< PeptideHit::PeakAnnotation > fragment_annotations
Definition: SimpleSearchEngineAlgorithm.h:77
OpenMS::SimpleSearchEngineAlgorithm::peptide_max_size_
Size peptide_max_size_
Definition: SimpleSearchEngineAlgorithm.h:130
OpenMS::SimpleSearchEngineAlgorithm::peptide_motif_
String peptide_motif_
Definition: SimpleSearchEngineAlgorithm.h:133
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:144
OpenMS::SimpleSearchEngineAlgorithm::peptide_min_size_
Size peptide_min_size_
Definition: SimpleSearchEngineAlgorithm.h:129
OpenMS::IdXMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &protein_ids, const std::vector< PeptideIdentification > &peptide_ids, const String &document_id="")
Stores the data in an idXML file.
OpenMS::SimpleSearchEngineAlgorithm::fragment_mass_tolerance_unit_
String fragment_mass_tolerance_unit_
Definition: SimpleSearchEngineAlgorithm.h:119
OpenMS::File::basename
static String basename(const String &file)
Returns the basename of the file (without the path).
OpenMS::SimpleSearchEngineAlgorithm::search
ExitCodes search(const String &in_mzML, const String &in_db, std::vector< ProteinIdentification > &prot_ids, std::vector< PeptideIdentification > &pep_ids) const
search spectra against database
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
IdXMLFile.h
OpenMS::SimpleSearchEngineAlgorithm::precursor_mass_tolerance_
double precursor_mass_tolerance_
Definition: SimpleSearchEngineAlgorithm.h:109
OpenMS::SimpleSearchEngineAlgorithm::report_top_hits_
Size report_top_hits_
Definition: SimpleSearchEngineAlgorithm.h:135
OpenMS::IntList
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:55
OpenMS::SimpleSearchEngineAlgorithm::modifications_variable_
StringList modifications_variable_
Definition: SimpleSearchEngineAlgorithm.h:123
OpenMS::SimpleSearchEngineAlgorithm::precursor_isotopes_
IntList precursor_isotopes_
Definition: SimpleSearchEngineAlgorithm.h:115
OpenMS::SimpleSearchEngineAlgorithm::modifications_fixed_
StringList modifications_fixed_
Definition: SimpleSearchEngineAlgorithm.h:121
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
OpenMS::SimpleSearchEngineAlgorithm::enzyme_
String enzyme_
Definition: SimpleSearchEngineAlgorithm.h:127
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
ProgressLogger.h
int
OpenMS::SimpleSearchEngineAlgorithm::ExitCodes::EXECUTION_OK
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::score
double score
main score
Definition: SimpleSearchEngineAlgorithm.h:76
OpenMS::StringView
StringView provides a non-owning view on an existing string.
Definition: String.h:488
OpenMS::SimpleSearchEngineAlgorithm::modifications_max_variable_mods_per_peptide_
Size modifications_max_variable_mods_per_peptide_
Definition: SimpleSearchEngineAlgorithm.h:125
OpenMS::SimpleSearchEngineAlgorithm::peptide_missed_cleavages_
Size peptide_missed_cleavages_
Definition: SimpleSearchEngineAlgorithm.h:131
OpenMS::SimpleSearchEngineAlgorithm
Definition: SimpleSearchEngineAlgorithm.h:46
OpenMS::SimpleSearchEngineAlgorithm::precursor_mass_tolerance_unit_
String precursor_mass_tolerance_unit_
Definition: SimpleSearchEngineAlgorithm.h:110
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_
Slimmer structure as storing all scored candidates in PeptideHit objects takes too much space.
Definition: SimpleSearchEngineAlgorithm.h:72
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::peptide_mod_index
SignedSize peptide_mod_index
enumeration index of the non-RNA peptide modification
Definition: SimpleSearchEngineAlgorithm.h:75
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:73
MSExperiment.h
OpenMS::SignedSize
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
OpenMS::SimpleSearchEngineAlgorithm::precursor_min_charge_
Size precursor_min_charge_
Definition: SimpleSearchEngineAlgorithm.h:112
OpenMS::SimpleSearchEngineAlgorithm::precursor_max_charge_
Size precursor_max_charge_
Definition: SimpleSearchEngineAlgorithm.h:113
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::sequence
StringView sequence
Definition: SimpleSearchEngineAlgorithm.h:74
OpenMS::ModifiedPeptideGenerator::MapToResidueType
Definition: ModifiedPeptideGenerator.h:58
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:73
ModifiedPeptideGenerator.h
OpenMS::SimpleSearchEngineAlgorithm::fragment_mass_tolerance_
double fragment_mass_tolerance_
Definition: SimpleSearchEngineAlgorithm.h:117
SimpleSearchEngineAlgorithm.h
OpenMS::SimpleSearchEngineAlgorithm::AnnotatedHit_::hasBetterScore
static bool hasBetterScore(const AnnotatedHit_ &a, const AnnotatedHit_ &b)
Definition: SimpleSearchEngineAlgorithm.h:78
OpenMS::Param::insert
void insert(const String &prefix, const Param &param)
OpenMS::SimpleSearchEngineAlgorithm::ExitCodes
ExitCodes
Exit codes.
Definition: SimpleSearchEngineAlgorithm.h:54
StandardTypes.h
File.h
OpenMS::ProgressLogger::setLogType
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
TOPPBase.h
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:63