OpenMS
MRMDecoy.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: George Rosenberger $
6 // $Authors: George Rosenberger, Hannes Roest $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
15 
16 
17 #include <string>
18 #include <utility> // for pair
19 #include <vector>
20 #include <map>
21 
22 // #define DEBUG_MRMDECOY
23 
24 namespace OpenMS
25 {
55  class OPENMS_DLLAPI MRMDecoy :
56  public DefaultParamHandler,
57  public ProgressLogger
58  {
59 
60 public:
61 
62  typedef std::vector<size_t> IndexType;
63 
65 
90  const String& method,
91  const double aim_decoy_fraction,
92  const bool switchKR,
93  const String& decoy_tag,
94  const int max_attempts,
95  const double identity_threshold,
96  const double precursor_mz_shift,
97  const double product_mz_shift,
98  const double product_mz_threshold,
99  const std::vector<String>& fragment_types,
100  const std::vector<size_t>& fragment_charges,
101  const bool enable_specific_losses,
102  const bool enable_unspecific_losses,
103  const int round_decPow = -4) const;
104 
112 
113  typedef std::vector<OpenMS::TargetedExperiment::Protein> ProteinVectorType;
114  typedef std::vector<OpenMS::TargetedExperiment::Peptide> PeptideVectorType;
115  typedef std::vector<OpenMS::ReactionMonitoringTransition> TransitionVectorType;
116 
117  typedef std::map<String, std::vector<const ReactionMonitoringTransition*> > PeptideTransitionMapType;
118 
123  float AASequenceIdentity(const String& sequence, const String& decoy) const;
124 
134  const double identity_threshold,
135  int seed = -1,
136  const int max_attempts = 100) const;
137 
148  const bool keepN,
149  const bool keepC,
150  const String& const_pattern = String());
151 
160  static IndexType findFixedResidues(const std::string& sequence,
161  bool keepN, bool keepC, const OpenMS::String& keep_const_pattern);
162 
163 protected:
164 
168  bool hasCNterminalMods_(const OpenMS::TargetedExperiment::Peptide& peptide, bool checkCterminalAA) const;
169 
175  IndexType findFixedResidues_(const std::string& sequence) const;
176 
182  IndexType findFixedAndTermResidues_(const std::string& sequence) const;
183 
191  const OpenMS::TargetedExperiment::Peptide& peptide) const;
192 
199  const OpenMS::TargetedExperiment::Peptide& peptide) const;
200 
205 
207  void updateMembers_() override;
208 
210  bool keepN_;
211  bool keepC_;
212  };
213 }
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
This class generates a TargetedExperiment object with decoys based on a TargetedExperiment object.
Definition: MRMDecoy.h:58
std::vector< size_t > IndexType
Definition: MRMDecoy.h:62
IndexType findFixedResidues_(const std::string &sequence) const
Find all K, R, P sites in a sequence to be set as fixed.
bool keepC_
Definition: MRMDecoy.h:211
std::map< String, std::vector< const ReactionMonitoringTransition * > > PeptideTransitionMapType
Definition: MRMDecoy.h:117
String getModifiedPeptideSequence_(const OpenMS::TargetedExperiment::Peptide &pep) const
Convert a peptide to a string which contains the peptide sequence and modifications.
static IndexType findFixedResidues(const std::string &sequence, bool keepN, bool keepC, const OpenMS::String &keep_const_pattern)
Find all residues in a sequence that should not be reversed / shuffled.
std::vector< OpenMS::ReactionMonitoringTransition > TransitionVectorType
Definition: MRMDecoy.h:115
static OpenMS::TargetedExperiment::Peptide reversePeptide(const OpenMS::TargetedExperiment::Peptide &peptide, const bool keepN, const bool keepC, const String &const_pattern=String())
Reverse a peptide sequence (with its modifications)
IndexType findFixedAndTermResidues_(const std::string &sequence) const
Find all K, R, P and C-/N-terminal sites in a sequence to be set as fixed.
std::vector< OpenMS::TargetedExperiment::Peptide > PeptideVectorType
Definition: MRMDecoy.h:114
String keep_const_pattern_
Definition: MRMDecoy.h:209
void switchKR(OpenMS::TargetedExperiment::Peptide &peptide) const
Switch the final Amino Acid of a tryptic peptide. E.g. If the last Amino Acid is "K" switch to "R" (a...
bool keepN_
Definition: MRMDecoy.h:210
std::vector< OpenMS::TargetedExperiment::Protein > ProteinVectorType
Definition: MRMDecoy.h:113
void updateMembers_() override
Synchronize members with param class.
bool hasCNterminalMods_(const OpenMS::TargetedExperiment::Peptide &peptide, bool checkCterminalAA) const
Check if a peptide has C or N terminal modifications.
float AASequenceIdentity(const String &sequence, const String &decoy) const
Compute relative identity (relative number of matches of amino acids at the same position) between tw...
OpenMS::TargetedExperiment::Peptide reversePeptide_(const OpenMS::TargetedExperiment::Peptide &peptide) const
Reverse a peptide sequence (with its modifications)
void generateDecoys(const OpenMS::TargetedExperiment &exp, OpenMS::TargetedExperiment &dec, const String &method, const double aim_decoy_fraction, const bool switchKR, const String &decoy_tag, const int max_attempts, const double identity_threshold, const double precursor_mz_shift, const double product_mz_shift, const double product_mz_threshold, const std::vector< String > &fragment_types, const std::vector< size_t > &fragment_charges, const bool enable_specific_losses, const bool enable_unspecific_losses, const int round_decPow=-4) const
Generate decoys from a TargetedExperiment.
OpenMS::TargetedExperiment::Peptide pseudoreversePeptide_(const OpenMS::TargetedExperiment::Peptide &peptide) const
Pseudo-reverse a peptide sequence (with its modifications)
OpenMS::TargetedExperiment::Peptide shufflePeptide(OpenMS::TargetedExperiment::Peptide peptide, const double identity_threshold, int seed=-1, const int max_attempts=100) const
Shuffle a peptide (with its modifications) sequence.
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
A more convenient string class.
Definition: String.h:34
Represents a peptide (amino acid sequence)
Definition: TargetedExperimentHelper.h:333
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:39
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19