OpenMS
Loading...
Searching...
No Matches
ModifiedPeptideGenerator.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: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
13
16#include <vector>
17#include <map>
18#include <unordered_map>
19#include <set>
20
21namespace OpenMS
22{
45 class OPENMS_DLLAPI ModifiedPeptideGenerator
46 {
47 public:
59 struct MapToResidueType { std::unordered_map<const ResidueModification*, const Residue*> val; };
60
72
88 const MapToResidueType& fixed_mods,
89 AASequence& peptide);
90
115 const MapToResidueType& var_mods,
116 const AASequence& peptide,
117 Size max_variable_mods_per_peptide,
118 std::vector<AASequence>& all_modified_peptides,
119 bool keep_original=true);
120
121 protected:
126
138 static MapToResidueType createResidueModificationToResidueMap_(const std::vector<const ResidueModification*>& mods);
139
153 const MapToResidueType& var_mods,
154 const AASequence& peptide,
155 std::vector<AASequence>& all_modified_peptides,
156 bool keep_original=true);
157
158 private:
160 static void applyAllModsAtIdxAndExtend_(std::vector<AASequence>& original_sequences, int idx_to_modify, const std::vector<const ResidueModification*>& mods, const MapToResidueType& var_mods);
162 static void applyModToPep_(AASequence& current_peptide, int current_index, const ResidueModification* m, const MapToResidueType& var_mods);
163 };
164}
Representation of a peptide/protein sequence.
Definition AASequence.h:88
Generate fixed- and variable-modification variants of an AASequence, lock-free.
Definition ModifiedPeptideGenerator.h:46
static void applyVariableModifications(const MapToResidueType &var_mods, const AASequence &peptide, Size max_variable_mods_per_peptide, std::vector< AASequence > &all_modified_peptides, bool keep_original=true)
Enumerate all peptide variants obtained by combinatorially placing up to max_variable_mods_per_peptid...
std::unordered_map< const ResidueModification *, const Residue * > val
Definition ModifiedPeptideGenerator.h:59
static const int N_TERM_MODIFICATION_INDEX
Sentinel index used internally to mark a strict N_TERM-only modification placed at the N-terminal res...
Definition ModifiedPeptideGenerator.h:123
static MapToResidueType getModifications(const StringList &modNames)
Resolve modification names from UniMod terms and pre-cache the corresponding modified Residue pointer...
static void applyModToPep_(AASequence &current_peptide, int current_index, const ResidueModification *m, const MapToResidueType &var_mods)
Install modification m on current_peptide at residue index current_index, looking up the pre-cached m...
static void applyAtMostOneVariableModification_(const MapToResidueType &var_mods, const AASequence &peptide, std::vector< AASequence > &all_modified_peptides, bool keep_original=true)
Fast path for the common case where exactly one variable modification is placed per peptide.
static const int C_TERM_MODIFICATION_INDEX
Sentinel index used internally to mark a strict C_TERM-only modification placed at the C-terminal res...
Definition ModifiedPeptideGenerator.h:125
static void applyAllModsAtIdxAndExtend_(std::vector< AASequence > &original_sequences, int idx_to_modify, const std::vector< const ResidueModification * > &mods, const MapToResidueType &var_mods)
For each modification in mods, extend original_sequences with a copy carrying that mod at idx_to_modi...
static void applyFixedModifications(const MapToResidueType &fixed_mods, AASequence &peptide)
Apply all compatible fixed modifications in fixed_mods to peptide in place.
static MapToResidueType createResidueModificationToResidueMap_(const std::vector< const ResidueModification * > &mods)
Build the ResidueModification -> Residue cache used by the apply* methods (the lock-free trick — see ...
Cached mapping ResidueModification* -> already-instantiated modified Residue*.
Definition ModifiedPeptideGenerator.h:59
Representation of a modification on an amino acid residue.
Definition ResidueModification.h:55
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19