OpenMS
ModificationDefinitionsSet.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: Timo Sachsenberg $
6 // $Authors: $
7 // --------------------------------------------------------------------------
8 //
9 
10 #pragma once
11 
14 #include <OpenMS/CONCEPT/Types.h> // for "UInt"
16 #include <OpenMS/DATASTRUCTURES/ListUtils.h> // for "StringList"
19 
20 #include <set>
21 
22 namespace OpenMS
23 {
32  class OPENMS_DLLAPI ModificationDefinitionsSet
33  {
34 public:
35 
41 
44 
46  ModificationDefinitionsSet(const StringList& fixed_modifications, const StringList& variable_modifications);
47 
51 
56  void setMaxModifications(Size max_mod);
57 
60 
63 
66 
69 
72 
74  void setModifications(const std::set<ModificationDefinition>& mod_defs);
75 
82  void setModifications(const String& fixed_modifications, const String& variable_modifications);
83 
85  void setModifications(const StringList& fixed_modifications, const StringList& variable_modifications);
86 
88  std::set<ModificationDefinition> getModifications() const;
89 
91  const std::set<ModificationDefinition>& getFixedModifications() const;
92 
94  const std::set<ModificationDefinition>& getVariableModifications() const;
95 
97  std::set<String> getModificationNames() const;
98 
100  void getModificationNames(StringList& fixed_modifications, StringList& variable_modifications) const;
101 
103  std::set<String> getFixedModificationNames() const;
104 
106  std::set<String> getVariableModificationNames() const;
108 
115 
120  bool isCompatible(const AASequence& peptide) const;
121 
123  bool operator==(const ModificationDefinitionsSet& rhs) const;
124 
126  bool operator!=(const ModificationDefinitionsSet& rhs) const;
128 
143  void findMatches(std::multimap<double, ModificationDefinition>& matches, double mass, const String& residue = "", ResidueModification::TermSpecificity term_spec = ResidueModification::NUMBER_OF_TERM_SPECIFICITY, bool consider_fixed = true, bool consider_variable = true, bool is_delta = true, double tolerance = 0.01) const;
144 
146  void inferFromPeptides(const std::vector<PeptideIdentification>& peptides);
147 
148 protected:
149 
150  std::set<ModificationDefinition> variable_mods_;
151 
152  std::set<ModificationDefinition> fixed_mods_;
153 
155 
157  static void addMatches_(std::multimap<double, ModificationDefinition>& matches, double mass, const String& residue, ResidueModification::TermSpecificity term_spec, const std::set<ModificationDefinition>& source, bool is_delta, double tolerance);
158 
159  };
160 
161 } // namespace OpenMS
162 
Representation of a peptide/protein sequence.
Definition: AASequence.h:86
Representation of modification definition.
Definition: ModificationDefinition.h:27
Representation of a set of modification definitions.
Definition: ModificationDefinitionsSet.h:33
Size getNumberOfModifications() const
returns the number of modifications stored in this set
bool operator==(const ModificationDefinitionsSet &rhs) const
equality operator
void setModifications(const StringList &fixed_modifications, const StringList &variable_modifications)
same as above, but using StringList instead of comma separated strings
Size max_mods_per_peptide_
Definition: ModificationDefinitionsSet.h:154
bool isCompatible(const AASequence &peptide) const
returns true if the peptide is compatible with the definitions, e.g. does not contain other modificat...
std::set< String > getFixedModificationNames() const
returns only the names of the fixed modifications
std::set< String > getVariableModificationNames() const
returns only the names of the variable modifications
virtual ~ModificationDefinitionsSet()
destructor
ModificationDefinitionsSet()
default constructor
std::set< String > getModificationNames() const
returns only the names of the modifications stored in the set
void setModifications(const std::set< ModificationDefinition > &mod_defs)
sets the modification definitions
void inferFromPeptides(const std::vector< PeptideIdentification > &peptides)
Infers the sets of defined modifications from the modifications present on peptide identifications.
Size getNumberOfVariableModifications() const
returns the number of variable modifications stored in this set
static void addMatches_(std::multimap< double, ModificationDefinition > &matches, double mass, const String &residue, ResidueModification::TermSpecificity term_spec, const std::set< ModificationDefinition > &source, bool is_delta, double tolerance)
helper function for findMatches() - finds matching modifications in source and adds them to matches
const std::set< ModificationDefinition > & getFixedModifications() const
returns the stored fixed modification definitions
ModificationDefinitionsSet(const StringList &fixed_modifications, const StringList &variable_modifications)
detailed constructor with StringLists
void getModificationNames(StringList &fixed_modifications, StringList &variable_modifications) const
populates the output lists with the modification names (use e.g. for ProteinIdentification::SearchPar...
Size getMaxModifications() const
return the maximal number of modifications allowed per peptide
const std::set< ModificationDefinition > & getVariableModifications() const
returns the stored variable modification definitions
bool operator!=(const ModificationDefinitionsSet &rhs) const
inequality operator
std::set< ModificationDefinition > fixed_mods_
Definition: ModificationDefinitionsSet.h:152
void findMatches(std::multimap< double, ModificationDefinition > &matches, double mass, const String &residue="", ResidueModification::TermSpecificity term_spec=ResidueModification::NUMBER_OF_TERM_SPECIFICITY, bool consider_fixed=true, bool consider_variable=true, bool is_delta=true, double tolerance=0.01) const
Finds modifications in the set that match a given (delta) mass.
void setModifications(const String &fixed_modifications, const String &variable_modifications)
set the modification definitions from a string
Size getNumberOfFixedModifications() const
returns the number of fixed modifications stored in this set
void addModification(const ModificationDefinition &mod_def)
adds a modification definition to the set
std::set< ModificationDefinition > getModifications() const
returns the stored modification definitions
std::set< ModificationDefinition > variable_mods_
Definition: ModificationDefinitionsSet.h:150
ModificationDefinitionsSet & operator=(const ModificationDefinitionsSet &element)
assignment operator
void setMaxModifications(Size max_mod)
sets the maximal number of modifications allowed per peptide
ModificationDefinitionsSet(const ModificationDefinitionsSet &rhs)
copy constructor
TermSpecificity
Position where the modification is allowed to occur.
Definition: ResidueModification.h:72
@ NUMBER_OF_TERM_SPECIFICITY
Definition: ResidueModification.h:78
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22