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
68 std::vector<AASequence> shuffle(const AASequence& protein, const std::string& protease, int decoy_factor = 1);
69
70 /*
71 @brief shuffle the protein's peptide sequences between enzymatic cutting positions.
72 each peptide is shuffled @p max_attempts times to minimize sequence identity.
73
74 Note:
75 - Generated decoys are retrieved from a cache to prevent that same peptide (in different proteins)
76 leads to different decoys.
77 - modifications are discarded
78 */
80 const AASequence& aas,
81 const std::string& protease,
82 const int max_attempts = 100
83 );
84
85 private:
86 // sequence identity by matching AAs
87 static double SequenceIdentity_(const std::string& decoy, const std::string& target);
88
89 // portable shuffle
91
92 // ensures that shuffling same peptide (in different proteins) leads to same decoy
93 std::unordered_map<std::string, std::string> td_cache_;
94 };
95}
96
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:93
Math::RandomShuffler shuffler_
Definition DecoyGenerator.h:90
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