Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
MRMAssay.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-2017.
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 $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
42 
43 #include <boost/bind.hpp>
44 #include <boost/lexical_cast.hpp>
45 #include <boost/random/mersenne_twister.hpp>
46 #include <boost/random/uniform_int.hpp>
47 #include <boost/random/variate_generator.hpp>
48 
49 // #define DEBUG_MRMASSAY
50 
51 namespace OpenMS
52 {
66  class OPENMS_DLLAPI MRMAssay :
67  public ProgressLogger
68  {
69 
70 public:
72  MRMAssay(); // empty, no members
74 
76  ~MRMAssay();
78 
79  typedef std::vector<OpenMS::TargetedExperiment::Protein> ProteinVectorType;
80  typedef std::vector<OpenMS::TargetedExperiment::Peptide> PeptideVectorType;
81  typedef std::vector<OpenMS::ReactionMonitoringTransition> TransitionVectorType;
82 
83  typedef std::map<String, std::vector<const ReactionMonitoringTransition*> > PeptideTransitionMapType;
84 
85  typedef boost::unordered_map<size_t, boost::unordered_map<String, std::set<std::string> > > SequenceMapT;
86  typedef boost::unordered_map<size_t, boost::unordered_map<String, std::vector<std::pair<double, std::string> > > > IonMapT;
87  typedef std::map<String, std::vector<std::pair<std::string, double> > > PeptideMapT;
88  typedef boost::unordered_map<String, String> SequenceMap_T;
89 
90  typedef boost::unordered_map<String, TargetedExperiment::Peptide> TargetDecoyMapT;
91 
105  void reannotateTransitions(OpenMS::TargetedExperiment& exp, double precursor_mz_threshold, double product_mz_threshold, std::vector<String> fragment_types, std::vector<size_t> fragment_charges, bool enable_specific_losses, bool enable_unspecific_losses, int round_decPow = -4);
106 
117  void restrictTransitions(OpenMS::TargetedExperiment& exp, double lower_mz_limit, double upper_mz_limit, std::vector<std::pair<double, double> > swathes);
118 
127  void detectingTransitions(OpenMS::TargetedExperiment& exp, int min_transitions, int max_transitions);
128 
145  void uisTransitions(OpenMS::TargetedExperiment& exp,
146  std::vector<String> fragment_types,
147  std::vector<size_t> fragment_charges,
148  bool enable_specific_losses,
149  bool enable_unspecific_losses,
150  bool enable_ms2_precursors,
151  double mz_threshold,
152  std::vector<std::pair<double, double> > swathes,
153  int round_decPow = -4,
154  size_t max_num_alternative_localizations = 20,
155  int shuffle_seed = -1,
156  bool disable_decoy_transitions = false);
157 
158 protected:
168  std::vector<std::string> getMatchingPeptidoforms_(const double fragment_ion,
169  const std::vector<std::pair<double, std::string> >& ions,
170  const double mz_threshold);
171 
180  int getSwath_(const std::vector<std::pair<double, double> >& swathes, const double precursor_mz);
181 
191  bool isInSwath_(const std::vector<std::pair<double, double> >& swathes, const double precursor_mz, const double product_mz);
192 
201  std::string getRandomSequence_(size_t sequence_size, boost::variate_generator<boost::mt19937&, boost::uniform_int<> > pseudoRNG);
202 
211  std::vector<std::vector<size_t> > nchoosekcombinations_(std::vector<size_t> n, size_t k);
212 
224  std::vector<OpenMS::AASequence> addModificationsSequences_(std::vector<OpenMS::AASequence> sequences, std::vector<std::vector<size_t> > mods_combs, OpenMS::String modification);
225 
237  std::vector<OpenMS::AASequence> combineModifications_(OpenMS::AASequence sequence);
238 
256  std::vector<OpenMS::AASequence> combineDecoyModifications_(OpenMS::AASequence sequence, OpenMS::AASequence decoy_sequence);
257 
264  void generateTargetInSilicoMap_(OpenMS::TargetedExperiment& exp,
265  std::vector<String> fragment_types,
266  std::vector<size_t> fragment_charges,
267  bool enable_specific_losses,
268  bool enable_unspecific_losses,
269  bool enable_ms2_precursors,
270  std::vector<std::pair<double, double> > swathes,
271  int round_decPow,
272  size_t max_num_alternative_localizations,
273  SequenceMapT& TargetSequenceMap,
274  IonMapT& TargetIonMap,
275  PeptideMapT& TargetPeptideMap);
276 
283  void generateDecoySequences_(boost::unordered_map<size_t,
284  boost::unordered_map<String, std::set<std::string> > >& TargetSequenceMap,
285  boost::unordered_map<String, String>& DecoySequenceMap,
286  int shuffle_seed);
287 
294  void generateDecoyInSilicoMap_(OpenMS::TargetedExperiment& exp,
295  std::vector<String> fragment_types, std::vector<size_t> fragment_charges,
296  bool enable_specific_losses,
297  bool enable_unspecific_losses,
298  bool enable_ms2_precursors,
299  std::vector<std::pair<double, double> > swathes,
300  int round_decPow,
301  TargetDecoyMapT& TargetDecoyMap,
302  PeptideMapT& TargetPeptideMap,
303  boost::unordered_map<String, String>& DecoySequenceMap,
304  IonMapT& DecoyIonMap,
305  PeptideMapT& DecoyPeptideMap);
306 
313  void generateTargetAssays_(OpenMS::TargetedExperiment& exp,
314  TransitionVectorType& transitions, double mz_threshold,
315  std::vector<std::pair<double, double> > swathes,
316  int round_decPow,
317  PeptideMapT& TargetPeptideMap,
318  IonMapT& TargetIonMap);
319 
328  void generateDecoyAssays_(OpenMS::TargetedExperiment& exp,
329  TransitionVectorType& transitions,
330  double mz_threshold,
331  std::vector<std::pair<double, double> > swathes,
332  int round_decPow,
333  PeptideMapT& DecoyPeptideMap,
334  TargetDecoyMapT& TargetDecoyMap,
335  IonMapT DecoyIonMap,
336  IonMapT TargetIonMap);
337 
338  };
339 }
340 
const double k
boost::unordered_map< size_t, boost::unordered_map< String, std::set< std::string > > > SequenceMapT
Definition: MRMAssay.h:85
Generate assays from a TargetedExperiment.
Definition: MRMAssay.h:66
A more convenient string class.
Definition: String.h:57
Representation of a peptide/protein sequence.
Definition: AASequence.h:107
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
boost::unordered_map< size_t, boost::unordered_map< String, std::vector< std::pair< double, std::string > > > > IonMapT
Definition: MRMAssay.h:86
std::map< String, std::vector< std::pair< std::string, double > > > PeptideMapT
Definition: MRMAssay.h:87
boost::unordered_map< String, TargetedExperiment::Peptide > TargetDecoyMapT
Definition: MRMAssay.h:90
boost::unordered_map< String, String > SequenceMap_T
Definition: MRMAssay.h:88
std::vector< OpenMS::TargetedExperiment::Peptide > PeptideVectorType
Definition: MRMAssay.h:80
std::vector< OpenMS::TargetedExperiment::Protein > ProteinVectorType
Definition: MRMAssay.h:79
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:61
std::vector< OpenMS::ReactionMonitoringTransition > TransitionVectorType
Definition: MRMAssay.h:81
std::map< String, std::vector< const ReactionMonitoringTransition * > > PeptideTransitionMapType
Definition: MRMAssay.h:83

OpenMS / TOPP release 2.3.0 Documentation generated on Wed Apr 18 2018 19:29:06 using doxygen 1.8.14