OpenMS  3.0.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-2022.
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 <utility> // for pair
45 #include <vector>
46 #include <map>
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 
90  MRMDecoy();
91 
114  void generateDecoys(const OpenMS::TargetedExperiment& exp,
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 
137  void switchKR(OpenMS::TargetedExperiment::Peptide& peptide) const;
138 
139  typedef std::vector<OpenMS::TargetedExperiment::Protein> ProteinVectorType;
140  typedef std::vector<OpenMS::TargetedExperiment::Peptide> PeptideVectorType;
141  typedef std::vector<OpenMS::ReactionMonitoringTransition> TransitionVectorType;
142 
143  typedef std::map<String, std::vector<const ReactionMonitoringTransition*> > PeptideTransitionMapType;
144 
149  float AASequenceIdentity(const String& sequence, const String& decoy) const;
150 
160  const double identity_threshold,
161  int seed = -1,
162  const int max_attempts = 100) const;
163 
172  static OpenMS::TargetedExperiment::Peptide reversePeptide(
174  const bool keepN,
175  const bool keepC,
176  const String& const_pattern = String());
177 
186  static IndexType findFixedResidues(const std::string& sequence,
187  bool keepN, bool keepC, const OpenMS::String& keep_const_pattern);
188 
189 protected:
190 
194  bool hasCNterminalMods_(const OpenMS::TargetedExperiment::Peptide& peptide, bool checkCterminalAA) const;
195 
201  IndexType findFixedResidues_(const std::string& sequence) const;
202 
208  IndexType findFixedAndTermResidues_(const std::string& sequence) const;
209 
216  OpenMS::TargetedExperiment::Peptide pseudoreversePeptide_(
217  const OpenMS::TargetedExperiment::Peptide& peptide) const;
218 
224  OpenMS::TargetedExperiment::Peptide reversePeptide_(
225  const OpenMS::TargetedExperiment::Peptide& peptide) const;
226 
230  String getModifiedPeptideSequence_(const OpenMS::TargetedExperiment::Peptide& pep) const;
231 
233  void updateMembers_() override;
234 
236  bool keepN_;
237  bool keepC_;
238  };
239 }
DefaultParamHandler.h
TargetedExperiment.h
OpenMS::MRMDecoy::keep_const_pattern_
String keep_const_pattern_
Definition: MRMDecoy.h:235
OpenMS::MRMDecoy::IndexType
std::vector< size_t > IndexType
Definition: MRMDecoy.h:88
OpenMS::TargetedExperimentHelper::Peptide
Represents a peptide (amino acid sequence)
Definition: TargetedExperimentHelper.h:358
OpenMS::MRMDecoy::ProteinVectorType
std::vector< OpenMS::TargetedExperiment::Protein > ProteinVectorType
Definition: MRMDecoy.h:139
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::MRMDecoy
This class generates a TargetedExperiment object with decoys based on a TargetedExperiment object.
Definition: MRMDecoy.h:81
OpenMS::MRMDecoy::TransitionVectorType
std::vector< OpenMS::ReactionMonitoringTransition > TransitionVectorType
Definition: MRMDecoy.h:141
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
ProgressLogger.h
MRMIonSeries.h
OpenMS::MRMDecoy::keepC_
bool keepC_
Definition: MRMDecoy.h:237
OpenMS::MRMDecoy::PeptideTransitionMapType
std::map< String, std::vector< const ReactionMonitoringTransition * > > PeptideTransitionMapType
Definition: MRMDecoy.h:143
OpenMS::MRMDecoy::keepN_
bool keepN_
Definition: MRMDecoy.h:236
OpenMS::TargetedExperiment
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:64
OpenMS::MRMDecoy::PeptideVectorType
std::vector< OpenMS::TargetedExperiment::Peptide > PeptideVectorType
Definition: MRMDecoy.h:140