OpenMS
Loading...
Searching...
No Matches
DecoyGenerator.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
14#include <unordered_map>
15
16namespace OpenMS
17{
18 class AASequence;
19 class DigestionEnzymeProtein;
20
24 class OPENMS_DLLAPI DecoyGenerator
25 {
26 public:
27 // initializes random generator
29
30 // destructor
31 ~DecoyGenerator() = default;
32
33 // random seed for shuffling
34 void setSeed(UInt64 seed);
35
36 /*
37 @brief reverses the protein sequence.
38 note: modifications are discarded
39 */
40 AASequence reverseProtein(const AASequence& protein) const;
41
42 /*
43 @brief reverses the protein's peptide sequences between enzymatic cutting positions.
44 With 'unspecific cleavage' (no enzymatic termini to keep), the whole protein is reversed (reverseProtein()).
45 note: modifications are discarded
46 */
47 AASequence reversePeptides(const AASequence& protein, const std::string& protease) const;
48
69 std::vector<AASequence> shuffle(const AASequence& protein, const std::string& protease, int decoy_factor = 1);
70
71 /*
72 @brief shuffle the protein's peptide sequences between enzymatic cutting positions.
73 each peptide is shuffled @p max_attempts times to minimize sequence identity.
74 With 'unspecific cleavage' (no enzymatic termini to keep), the whole protein is shuffled as one sequence.
75
76 Note:
77 - Generated decoys are retrieved from a cache to prevent that same peptide (in different proteins)
78 leads to different decoys.
79 - modifications are discarded
80 */
82 const AASequence& aas,
83 const std::string& protease,
84 const int max_attempts = 100
85 );
86
87 private:
88 // sequence identity by matching AAs
89 static double SequenceIdentity_(const std::string& decoy, const std::string& target);
90
91 // portable shuffle
93
94 // ensures that shuffling same peptide (in different proteins) leads to same decoy
95 std::unordered_map<std::string, std::string> td_cache_;
96 };
97}
98
Definition AASequence.h:96
Methods to generate isobaric decoy sequences for DDA target-decoy searches.
Definition DecoyGenerator.h:25
void setSeed(UInt64 seed)
AASequence shufflePeptides(const AASequence &aas, const std::string &protease, const int max_attempts=100)
std::unordered_map< std::string, std::string > td_cache_
Definition DecoyGenerator.h:95
Math::RandomShuffler shuffler_
Definition DecoyGenerator.h:92
AASequence reverseProtein(const AASequence &protein) const
std::vector< AASequence > shuffle(const AASequence &protein, const std::string &protease, int decoy_factor=1)
Generate decoy protein sequences using shuffle algorithm.
AASequence reversePeptides(const AASequence &protein, const std::string &protease) const
static double SequenceIdentity_(const std::string &decoy, const std::string &target)
Portable random shuffle with a reproducible, platform-independent random sequence.
Definition MathFunctions.h:479
uint64_t UInt64
Unsigned integer type (64bit)
Definition Types.h:47
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19