| OpenMS 2.5.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-2020.
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
37 #include <OpenMS/ANALYSIS/OPENSWATH/MRMIonSeries.h>
38 #include <OpenMS/ANALYSIS/TARGETED/TargetedExperiment.h>
39 #include <OpenMS/CONCEPT/ProgressLogger.h>
40 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
41
42 #include <boost/algorithm/string.hpp>
43 #include <boost/lexical_cast.hpp>
44 #include <boost/assign.hpp>
45 #include <boost/random/mersenne_twister.hpp>
46 #include <boost/random/uniform_int.hpp>
47 #include <boost/random/variate_generator.hpp>
48 #include <boost/unordered_map.hpp>
49
50 #include <string>
51 #include <vector>
52 #include <map>
53 #include <utility> // for pair
54
55 // #define DEBUG_MRMDECOY
56
57 namespace OpenMS
58 {
88 class OPENMS_DLLAPI MRMDecoy :
89 public DefaultParamHandler,
90 public ProgressLogger
91 {
92
93 public:
94
95 typedef std::vector<size_t> IndexType;
96
97 MRMDecoy();
98
121 void generateDecoys(const OpenMS::TargetedExperiment& exp,
122 OpenMS::TargetedExperiment& dec,
123 const String& method,
124 const double aim_decoy_fraction,
125 const bool switchKR,
126 const String& decoy_tag,
127 const int max_attempts,
128 const double identity_threshold,
129 const double precursor_mz_shift,
130 const double product_mz_shift,
131 const double product_mz_threshold,
132 const std::vector<String>& fragment_types,
133 const std::vector<size_t>& fragment_charges,
134 const bool enable_specific_losses,
135 const bool enable_unspecific_losses,
136 const int round_decPow = -4) const;
137
138 typedef std::vector<OpenMS::TargetedExperiment::Protein> ProteinVectorType;
139 typedef std::vector<OpenMS::TargetedExperiment::Peptide> PeptideVectorType;
140 typedef std::vector<OpenMS::ReactionMonitoringTransition> TransitionVectorType;
141
142 typedef std::map<String, std::vector<const ReactionMonitoringTransition*> > PeptideTransitionMapType;
143
148 float AASequenceIdentity(const String& sequence, const String& decoy) const;
149
157 OpenMS::TargetedExperiment::Peptide shufflePeptide(
158 OpenMS::TargetedExperiment::Peptide peptide,
159 const double identity_threshold,
160 int seed = -1,
161 const int max_attempts = 100) const;
162
171 static OpenMS::TargetedExperiment::Peptide reversePeptide(
172 const OpenMS::TargetedExperiment::Peptide& peptide,
173 const bool keepN,
174 const bool keepC,
175 const String& const_pattern = String());
176
185 static IndexType findFixedResidues(const std::string& sequence,
186 bool keepN, bool keepC, const OpenMS::String& keep_const_pattern);
187
188 protected:
189
193 bool hasCNterminalMods_(const OpenMS::TargetedExperiment::Peptide& peptide, bool checkCterminalAA) const;
194
200 IndexType findFixedResidues_(const std::string& sequence) const;
201
207 IndexType findFixedAndTermResidues_(const std::string& sequence) const;
208
215 OpenMS::TargetedExperiment::Peptide pseudoreversePeptide_(
216 const OpenMS::TargetedExperiment::Peptide& peptide) const;
217
223 OpenMS::TargetedExperiment::Peptide reversePeptide_(
224 const OpenMS::TargetedExperiment::Peptide& peptide) const;
225
227 void updateMembers_() override;
228
229 String keep_const_pattern_;
230 bool keepN_;
231 bool keepC_;
232 };
233 }
234
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
TargetedExperiment.h
OpenMS::MRMDecoy::TransitionVectorType
std::vector< OpenMS::ReactionMonitoringTransition > TransitionVectorType
Definition: MRMDecoy.h:140
OpenMS::MRMDecoy::keepN_
bool keepN_
Definition: MRMDecoy.h:230
OpenMS::MRMDecoy::ProteinVectorType
std::vector< OpenMS::TargetedExperiment::Protein > ProteinVectorType
Definition: MRMDecoy.h:138
OpenMS::MRMDecoy::IndexType
std::vector< size_t > IndexType
Definition: MRMDecoy.h:95
OpenMS::MRMDecoy
This class generates a TargetedExperiment object with decoys based on a TargetedExperiment object...
Definition: MRMDecoy.h:88
ProgressLogger.h
OpenMS::TargetedExperiment
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:64
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::MRMDecoy::keep_const_pattern_
String keep_const_pattern_
Definition: MRMDecoy.h:229
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
DefaultParamHandler.h
OpenMS::MRMDecoy::keepC_
bool keepC_
Definition: MRMDecoy.h:231
OpenMS::TargetedExperimentHelper::Peptide
Represents a peptide (amino acid sequence)
Definition: TargetedExperimentHelper.h:370
MRMIonSeries.h
OpenMS::MRMDecoy::PeptideVectorType
std::vector< OpenMS::TargetedExperiment::Peptide > PeptideVectorType
Definition: MRMDecoy.h:139
OpenMS::MRMDecoy::PeptideTransitionMapType
std::map< String, std::vector< const ReactionMonitoringTransition * > > PeptideTransitionMapType
Definition: MRMDecoy.h:142