OpenMS
PeptideSearchEngineFIAlgorithm.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: $
6 // $Authors: Raphael Förster $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 
18 
19 #include <vector>
20 
21 namespace OpenMS
22 {
23 
52 class OPENMS_DLLAPI PeptideSearchEngineFIAlgorithm :
53  public DefaultParamHandler,
54  public ProgressLogger
55 {
56  public:
58 
60  enum class ExitCodes
61  {
62  EXECUTION_OK,
63  INPUT_FILE_EMPTY,
64  UNEXPECTED_RESULT,
65  UNKNOWN_ERROR,
66  ILLEGAL_PARAMETERS
67  };
68 
90  ExitCodes search(const String& in_mzML,
91  const String& in_db,
92  std::vector<ProteinIdentification>& prot_ids,
93  PeptideIdentificationList& pep_ids) const;
94  protected:
95  void updateMembers_() override;
96 
99  {
101  /*
102  StringView sequence;
103  SignedSize peptide_mod_index; ///< enumeration index of the non-RNA peptide modification
104  */
105  double score = 0;
106  std::vector<PeptideHit::PeakAnnotation> fragment_annotations;
107  double prefix_fraction = 0;
108  double suffix_fraction = 0;
109  double mean_error = 0.0;
110  int isotope_error = 0;
111  uint16_t applied_charge = 0;
112  double delta_mass = 0.0;
113 
114  static bool hasBetterScore(const AnnotatedHit_& a, const AnnotatedHit_& b)
115  {
116  if (a.score != b.score) return a.score > b.score;
117  return a.sequence < b.sequence;
118  }
119  };
120 
122  static void preprocessSpectra_(PeakMap& exp, double fragment_mass_tolerance, bool fragment_mass_tolerance_unit_ppm);
123 
148  void postProcessHits_(const PeakMap& exp,
149  std::vector<std::vector<PeptideSearchEngineFIAlgorithm::AnnotatedHit_> >& annotated_hits,
150  std::vector<ProteinIdentification>& protein_ids,
151  PeptideIdentificationList& peptide_ids,
152  Size top_hits,
153  const StringList& modifications_fixed,
154  const StringList& modifications_variable,
155  Int peptide_missed_cleavages,
156  double precursor_mass_tolerance,
157  double fragment_mass_tolerance,
158  const String& precursor_mass_tolerance_unit_ppm,
159  const String& fragment_mass_tolerance_unit_ppm,
160  const Int precursor_min_charge,
161  const Int precursor_max_charge,
162  const String& enzyme,
163  const String& database_name) const;
164 
167 
170 
172 
174 
176 
178 
180 
182 
184 
185  bool decoys_;
186 
188 
192 
194 
196 
198  bool isOpenSearchMode_() const
199  {
200  return precursor_mass_tolerance_unit_ == "ppm"
201  ? (precursor_mass_tolerance_ > 1000.0)
202  : (precursor_mass_tolerance_ > 1.0);
203  }
204 };
205 
206 } // namespace
Representation of a peptide/protein sequence.
Definition: AASequence.h:86
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
Container for peptide identifications from multiple spectra.
Definition: PeptideIdentificationList.h:66
Fragment-index-based peptide database search algorithm (experimental).
Definition: PeptideSearchEngineFIAlgorithm.h:55
static void preprocessSpectra_(PeakMap &exp, double fragment_mass_tolerance, bool fragment_mass_tolerance_unit_ppm)
filter, deisotope, decharge spectra
Size peptide_max_size_
Definition: PeptideSearchEngineFIAlgorithm.h:190
Size precursor_max_charge_
Definition: PeptideSearchEngineFIAlgorithm.h:169
Size precursor_min_charge_
Definition: PeptideSearchEngineFIAlgorithm.h:168
Size report_top_hits_
Definition: PeptideSearchEngineFIAlgorithm.h:195
Size modifications_max_variable_mods_per_peptide_
Definition: PeptideSearchEngineFIAlgorithm.h:181
String precursor_mass_tolerance_unit_
Definition: PeptideSearchEngineFIAlgorithm.h:166
StringList modifications_fixed_
Definition: PeptideSearchEngineFIAlgorithm.h:177
String enzyme_
Definition: PeptideSearchEngineFIAlgorithm.h:183
Size peptide_min_size_
Definition: PeptideSearchEngineFIAlgorithm.h:189
String fragment_mass_tolerance_unit_
Definition: PeptideSearchEngineFIAlgorithm.h:175
IntList precursor_isotopes_
Definition: PeptideSearchEngineFIAlgorithm.h:171
bool decoys_
Definition: PeptideSearchEngineFIAlgorithm.h:185
StringList annotate_psm_
Definition: PeptideSearchEngineFIAlgorithm.h:187
ExitCodes search(const String &in_mzML, const String &in_db, std::vector< ProteinIdentification > &prot_ids, PeptideIdentificationList &pep_ids) const
Search spectra in an mzML file against a protein database using an FI-backed workflow.
double precursor_mass_tolerance_
Definition: PeptideSearchEngineFIAlgorithm.h:165
void postProcessHits_(const PeakMap &exp, std::vector< std::vector< PeptideSearchEngineFIAlgorithm::AnnotatedHit_ > > &annotated_hits, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, Size top_hits, 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.
bool isOpenSearchMode_() const
Helper function to determine if open search should be used based on tolerance.
Definition: PeptideSearchEngineFIAlgorithm.h:198
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
ExitCodes
Exit codes.
Definition: PeptideSearchEngineFIAlgorithm.h:61
StringList modifications_variable_
Definition: PeptideSearchEngineFIAlgorithm.h:179
double fragment_mass_tolerance_
Definition: PeptideSearchEngineFIAlgorithm.h:173
String peptide_motif_
Definition: PeptideSearchEngineFIAlgorithm.h:193
Size peptide_missed_cleavages_
Definition: PeptideSearchEngineFIAlgorithm.h:191
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
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
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: PeptideSearchEngineFIAlgorithm.h:99
static bool hasBetterScore(const AnnotatedHit_ &a, const AnnotatedHit_ &b)
Definition: PeptideSearchEngineFIAlgorithm.h:114
double score
main score
Definition: PeptideSearchEngineFIAlgorithm.h:105
AASequence sequence
Definition: PeptideSearchEngineFIAlgorithm.h:100
std::vector< PeptideHit::PeakAnnotation > fragment_annotations
Definition: PeptideSearchEngineFIAlgorithm.h:106