OpenMS
ConsensusIDAlgorithm.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Hendrik Weisser $
6 // $Authors: Andreas Bertsch, Marc Sturm, Sven Nahnsen, Hendrik Weisser $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 #include <map>
14 #include <vector>
15 
16 namespace OpenMS
17 {
33  class OPENMS_DLLAPI ConsensusIDAlgorithm : public DefaultParamHandler
34  {
35  public:
46  void apply(std::vector<PeptideIdentification>& ids, const std::map<String, String>& se_info, Size number_of_runs = 0);
47 
48  void apply(std::vector<PeptideIdentification>& ids, Size number_of_runs = 0);
49 
52 
53  protected:
54  struct HitInfo {
56  std::vector<double> scores;
57  std::vector<String> types;
58  // in case too much information is stored, TD and evidence
59  // could be re-annotated with PeptideIndexer later
61  std::set<PeptideEvidence> evidence;
62  double final_score;
63  double support;
64  // TODO: we could gather spectrum_refs here as well,
65  // to support passing of spectrum_ref if ALL refs of a group are the same
66  // For now, we do it in the ConsensusID TOPP tool class in cases where we
67  // know that refs will be the same.
68  };
69 
71  typedef std::map<AASequence, HitInfo> SequenceGrouping;
72 
75 
78 
80  double min_support_;
81 
84 
87 
90 
98  virtual void apply_(std::vector<PeptideIdentification>& ids, const std::map<String, String>& se_info, SequenceGrouping& results) = 0;
99 
101  void updateMembers_() override;
102 
104  void compareChargeStates_(Int& recorded_charge, Int new_charge, const AASequence& peptide);
105 
106  private:
109 
112  };
113 
114 } // namespace OpenMS
Representation of a peptide/protein sequence.
Definition: AASequence.h:86
Abstract base class for all ConsensusID algorithms (that calculate a consensus from multiple ID runs)...
Definition: ConsensusIDAlgorithm.h:34
void compareChargeStates_(Int &recorded_charge, Int new_charge, const AASequence &peptide)
Compare (and possibly update) charge state information.
Size considered_hits_
Number of peptide hits considered per ID run (input parameter)
Definition: ConsensusIDAlgorithm.h:74
std::set< PeptideEvidence > evidence
Definition: ConsensusIDAlgorithm.h:61
double support
Definition: ConsensusIDAlgorithm.h:63
String target_decoy
Definition: ConsensusIDAlgorithm.h:60
std::vector< double > scores
Definition: ConsensusIDAlgorithm.h:56
Size number_of_runs_
Number of ID runs.
Definition: ConsensusIDAlgorithm.h:77
double min_support_
Fraction of required support by other ID runs (input parameter)
Definition: ConsensusIDAlgorithm.h:80
bool count_empty_
Count empty runs in "min_support" calculation? (input parameter)
Definition: ConsensusIDAlgorithm.h:83
Int charge
Definition: ConsensusIDAlgorithm.h:55
std::map< AASequence, HitInfo > SequenceGrouping
Mapping: peptide sequence -> (charge, scores)
Definition: ConsensusIDAlgorithm.h:71
bool keep_old_scores_
Keep old scores?
Definition: ConsensusIDAlgorithm.h:86
ConsensusIDAlgorithm()
Default constructor.
double final_score
Definition: ConsensusIDAlgorithm.h:62
virtual void apply_(std::vector< PeptideIdentification > &ids, const std::map< String, String > &se_info, SequenceGrouping &results)=0
Consensus computation (to be implemented by subclasses).
void apply(std::vector< PeptideIdentification > &ids, Size number_of_runs=0)
void updateMembers_() override
Docu in base class.
ConsensusIDAlgorithm(const ConsensusIDAlgorithm &)=delete
Not implemented.
std::vector< String > types
Definition: ConsensusIDAlgorithm.h:57
void apply(std::vector< PeptideIdentification > &ids, const std::map< String, String > &se_info, Size number_of_runs=0)
Calculates the consensus ID for a set of peptide identifications of one spectrum or (consensus) featu...
ConsensusIDAlgorithm & operator=(const ConsensusIDAlgorithm &)=delete
Not implemented.
~ConsensusIDAlgorithm() override
Virtual destructor.
Definition: ConsensusIDAlgorithm.h:54
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
A more convenient string class.
Definition: String.h:34
int Int
Signed integer type.
Definition: Types.h:76
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22