OpenMS  2.8.0
MRMDecoy.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2021.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: George Rosenberger $
32 // $Authors: George Rosenberger, Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
41 
42 
43 #include <string>
44 #include <vector>
45 #include <map>
46 #include <utility> // for pair
47 
48 // #define DEBUG_MRMDECOY
49 
50 namespace OpenMS
51 {
81  class OPENMS_DLLAPI MRMDecoy :
82  public DefaultParamHandler,
83  public ProgressLogger
84  {
85 
86 public:
87 
88  typedef std::vector<size_t> IndexType;
89 
91 
116  const String& method,
117  const double aim_decoy_fraction,
118  const bool switchKR,
119  const String& decoy_tag,
120  const int max_attempts,
121  const double identity_threshold,
122  const double precursor_mz_shift,
123  const double product_mz_shift,
124  const double product_mz_threshold,
125  const std::vector<String>& fragment_types,
126  const std::vector<size_t>& fragment_charges,
127  const bool enable_specific_losses,
128  const bool enable_unspecific_losses,
129  const int round_decPow = -4) const;
130 
131  typedef std::vector<OpenMS::TargetedExperiment::Protein> ProteinVectorType;
132  typedef std::vector<OpenMS::TargetedExperiment::Peptide> PeptideVectorType;
133  typedef std::vector<OpenMS::ReactionMonitoringTransition> TransitionVectorType;
134 
135  typedef std::map<String, std::vector<const ReactionMonitoringTransition*> > PeptideTransitionMapType;
136 
141  float AASequenceIdentity(const String& sequence, const String& decoy) const;
142 
152  const double identity_threshold,
153  int seed = -1,
154  const int max_attempts = 100) const;
155 
166  const bool keepN,
167  const bool keepC,
168  const String& const_pattern = String());
169 
178  static IndexType findFixedResidues(const std::string& sequence,
179  bool keepN, bool keepC, const OpenMS::String& keep_const_pattern);
180 
181 protected:
182 
186  bool hasCNterminalMods_(const OpenMS::TargetedExperiment::Peptide& peptide, bool checkCterminalAA) const;
187 
193  IndexType findFixedResidues_(const std::string& sequence) const;
194 
200  IndexType findFixedAndTermResidues_(const std::string& sequence) const;
201 
209  const OpenMS::TargetedExperiment::Peptide& peptide) const;
210 
217  const OpenMS::TargetedExperiment::Peptide& peptide) const;
218 
220  void updateMembers_() override;
221 
223  bool keepN_;
224  bool keepC_;
225  };
226 }
227 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
This class generates a TargetedExperiment object with decoys based on a TargetedExperiment object.
Definition: MRMDecoy.h:84
std::vector< size_t > IndexType
Definition: MRMDecoy.h:88
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:224
std::map< String, std::vector< const ReactionMonitoringTransition * > > PeptideTransitionMapType
Definition: MRMDecoy.h:135
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:133
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:132
String keep_const_pattern_
Definition: MRMDecoy.h:222
bool keepN_
Definition: MRMDecoy.h:223
std::vector< OpenMS::TargetedExperiment::Protein > ProteinVectorType
Definition: MRMDecoy.h:131
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:53
A more convenient string class.
Definition: String.h:60
Represents a peptide (amino acid sequence)
Definition: TargetedExperimentHelper.h:360
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:65
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47