All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
BasicProteinInferenceAlgorithm.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: Julianus Pfeuffer $
6 // $Authors: Julianus Pfeuffer $
7 // --------------------------------------------------------------------------
8 #pragma once
9 
17 
18 namespace OpenMS
19 {
20 
36  class OPENMS_DLLAPI BasicProteinInferenceAlgorithm :
37  public DefaultParamHandler,
38  public ProgressLogger
39  {
40  public:
41 
42  typedef std::unordered_map<std::string, std::map<Int, PeptideHit*>> SequenceToChargeToPSM;
43 
47  enum class AggregationMethod
48  {
49  PROD,
50  SUM,
51  BEST
52  };
53 
56 
62  void run(PeptideIdentificationList& pep_ids, std::vector<ProteinIdentification>& prot_ids) const;
63 
69  void run(PeptideIdentificationList& pep_ids, ProteinIdentification& prot_id) const;
70 
78  void run(ConsensusMap& cmap, ProteinIdentification& prot_id, bool include_unassigned) const;
79 
80  private:
81 
92  std::unordered_map<std::string, std::pair<ProteinHit*, Size>>& acc_to_protein_hitP_and_count,
93  SequenceToChargeToPSM& best_pep,
94  ProteinIdentification& prot_run,
95  PeptideIdentificationList& pep_ids) const;
96 
106  SequenceToChargeToPSM& best_pep,
107  PeptideIdentificationList& pep_ids,
108  const String& overall_score_type,
109  bool higher_better,
110  const std::string& run_id) const;
111 
121  std::unordered_map<std::string, std::pair<ProteinHit*, Size>>& acc_to_protein_hitP_and_count,
122  const SequenceToChargeToPSM& best_pep,
123  bool pep_scores,
124  bool higher_better) const;
125 
127  AggregationMethod aggFromString_(const std::string& method_string) const;
128 
132  const String& score_type,
133  const AggregationMethod& aggregation_method
134  ) const;
135 
139  const IDScoreSwitcherAlgorithm::ScoreType& score_type,
140  const AggregationMethod& aggregation_method
141  ) const;
142 
144  double getInitScoreForAggMethod_(const AggregationMethod& aggregation_method, bool higher_better) const;
145 
147  typedef double (*fptr)(double, double);
148  fptr aggFunFromEnum_(const BasicProteinInferenceAlgorithm::AggregationMethod& agg_method, bool higher_better) const;
149  };
150 } //namespace OpenMS
Algorithm class that implements simple protein inference by aggregation of peptide scores....
Definition: BasicProteinInferenceAlgorithm.h:39
BasicProteinInferenceAlgorithm()
Default constructor.
void updateProteinScores_(std::unordered_map< std::string, std::pair< ProteinHit *, Size >> &acc_to_protein_hitP_and_count, const SequenceToChargeToPSM &best_pep, bool pep_scores, bool higher_better) const
aggregates and updates protein scores based on aggregation settings and aggregated peptide level resu...
void checkCompat_(const IDScoreSwitcherAlgorithm::ScoreType &score_type, const AggregationMethod &aggregation_method) const
void run(PeptideIdentificationList &pep_ids, std::vector< ProteinIdentification > &prot_ids) const
std::unordered_map< std::string, std::map< Int, PeptideHit * > > SequenceToChargeToPSM
Definition: BasicProteinInferenceAlgorithm.h:42
void checkCompat_(const String &score_type, const AggregationMethod &aggregation_method) const
void run(ConsensusMap &cmap, ProteinIdentification &prot_id, bool include_unassigned) const
double getInitScoreForAggMethod_(const AggregationMethod &aggregation_method, bool higher_better) const
get the initial score value based on the chosen aggregation_method, higher_better is needed for "best...
void aggregatePeptideScores_(SequenceToChargeToPSM &best_pep, PeptideIdentificationList &pep_ids, const String &overall_score_type, bool higher_better, const std::string &run_id) const
fills and updates the map of best peptide scores best_pep (by sequence or modified sequence,...
void run(PeptideIdentificationList &pep_ids, ProteinIdentification &prot_id) const
void processRun_(std::unordered_map< std::string, std::pair< ProteinHit *, Size >> &acc_to_protein_hitP_and_count, SequenceToChargeToPSM &best_pep, ProteinIdentification &prot_run, PeptideIdentificationList &pep_ids) const
Performs simple aggregation-based inference on one protein run.
AggregationMethod
The aggregation method.
Definition: BasicProteinInferenceAlgorithm.h:48
AggregationMethod aggFromString_(const std::string &method_string) const
get the AggregationMethod enum from a method_string
fptr aggFunFromEnum_(const BasicProteinInferenceAlgorithm::AggregationMethod &agg_method, bool higher_better) const
A container for consensus elements.
Definition: ConsensusMap.h:68
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
ScoreType
This is a rough hierarchy of possible score types in MS.
Definition: IDScoreSwitcherAlgorithm.h:54
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
Representation of a protein identification run.
Definition: ProteinIdentification.h:51
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19