OpenMS
Loading...
Searching...
No Matches
MRMDecoy.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- 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
16
17
18#include <string>
19#include <utility> // for pair
20#include <vector>
21#include <map>
22
23// #define DEBUG_MRMDECOY
24
25namespace OpenMS
26{
56 class OPENMS_DLLAPI MRMDecoy :
58 public ProgressLogger
59 {
60
61public:
62
63 typedef std::vector<size_t> IndexType;
64
66
91 const String& method,
92 const double aim_decoy_fraction,
93 const bool switchKR,
94 const String& decoy_tag,
95 const int max_attempts,
96 const double identity_threshold,
97 const double precursor_mz_shift,
98 const double product_mz_shift,
99 const double product_mz_threshold,
100 const std::vector<String>& fragment_types,
101 const std::vector<size_t>& fragment_charges,
102 const bool enable_specific_losses,
103 const bool enable_unspecific_losses,
104 const int round_decPow = -4) const;
105
131 const String& method,
132 const double aim_decoy_fraction,
133 const bool switchKR,
134 const String& decoy_tag,
135 const int max_attempts,
136 const double identity_threshold,
137 const double precursor_mz_shift,
138 const double product_mz_shift,
139 const double product_mz_threshold,
140 const std::vector<String>& fragment_types,
141 const std::vector<size_t>& fragment_charges,
142 const bool enable_specific_losses,
143 const bool enable_unspecific_losses,
144 const int round_decPow = -4) const;
145
153
154 typedef std::vector<OpenMS::TargetedExperiment::Protein> ProteinVectorType;
155 typedef std::vector<OpenMS::TargetedExperiment::Peptide> PeptideVectorType;
156 typedef std::vector<OpenMS::ReactionMonitoringTransition> TransitionVectorType;
157
158 typedef std::map<String, std::vector<const ReactionMonitoringTransition*> > PeptideTransitionMapType;
159
164 float AASequenceIdentity(const String& sequence, const String& decoy) const;
165
175 const double identity_threshold,
176 int seed = -1,
177 const int max_attempts = 100) const;
178
189 const bool keepN,
190 const bool keepC,
191 const String& const_pattern = String());
192
201 static IndexType findFixedResidues(const std::string& sequence,
202 bool keepN, bool keepC, const OpenMS::String& keep_const_pattern);
203
217 static std::pair<std::string, std::vector<OpenSwath::LightModification>> reversePeptideLight(
218 const std::string& sequence,
219 const std::vector<OpenSwath::LightModification>& modifications,
220 bool keepN,
221 bool keepC,
222 const String& const_pattern = String());
223
237 std::pair<std::string, std::vector<OpenSwath::LightModification>> shufflePeptideLight(
238 const std::string& sequence,
239 const std::vector<OpenSwath::LightModification>& modifications,
240 double identity_threshold,
241 int seed = -1,
242 int max_attempts = 100) const;
243
252 static void switchKRLight(std::string& sequence);
253
254protected:
255
259 bool hasCNterminalMods_(const OpenMS::TargetedExperiment::Peptide& peptide, bool checkCterminalAA) const;
260
272 const std::vector<OpenSwath::LightModification>& modifications,
273 size_t sequence_length,
274 bool checkCterminalAA);
275
285 std::pair<std::string, std::vector<OpenSwath::LightModification>> pseudoreversePeptideLight_(
286 const std::string& sequence,
287 const std::vector<OpenSwath::LightModification>& modifications) const;
288
294 IndexType findFixedResidues_(const std::string& sequence) const;
295
301 IndexType findFixedAndTermResidues_(const std::string& sequence) const;
302
310 const OpenMS::TargetedExperiment::Peptide& peptide) const;
311
318 const OpenMS::TargetedExperiment::Peptide& peptide) const;
319
324
326 void updateMembers_() override;
327
329 bool keepN_;
330 bool keepC_;
331 };
332}
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:59
std::vector< size_t > IndexType
Definition MRMDecoy.h:63
static bool hasCNterminalModsLight_(const std::vector< OpenSwath::LightModification > &modifications, size_t sequence_length, bool checkCterminalAA)
Check if light modifications include C or N terminal modifications.
IndexType findFixedResidues_(const std::string &sequence) const
Find all K, R, P sites in a sequence to be set as fixed.
void generateDecoysLight(const OpenSwath::LightTargetedExperiment &exp, OpenSwath::LightTargetedExperiment &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 LightTargetedExperiment (memory-efficient version)
bool keepC_
Definition MRMDecoy.h:330
std::map< String, std::vector< const ReactionMonitoringTransition * > > PeptideTransitionMapType
Definition MRMDecoy.h:158
String getModifiedPeptideSequence_(const OpenMS::TargetedExperiment::Peptide &pep) const
Convert a peptide to a string which contains the peptide sequence and modifications.
static void switchKRLight(std::string &sequence)
Switch the final amino acid of a tryptic peptide (light version)
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:156
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:155
static std::pair< std::string, std::vector< OpenSwath::LightModification > > reversePeptideLight(const std::string &sequence, const std::vector< OpenSwath::LightModification > &modifications, bool keepN, bool keepC, const String &const_pattern=String())
Reverse a peptide sequence (light version operating on strings)
String keep_const_pattern_
Definition MRMDecoy.h:328
std::pair< std::string, std::vector< OpenSwath::LightModification > > shufflePeptideLight(const std::string &sequence, const std::vector< OpenSwath::LightModification > &modifications, double identity_threshold, int seed=-1, int max_attempts=100) const
Shuffle a peptide sequence (light version operating on strings)
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:329
std::vector< OpenMS::TargetedExperiment::Protein > ProteinVectorType
Definition MRMDecoy.h:154
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...
std::pair< std::string, std::vector< OpenSwath::LightModification > > pseudoreversePeptideLight_(const std::string &sequence, const std::vector< OpenSwath::LightModification > &modifications) const
Pseudo-reverse a peptide sequence (light version)
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:335
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
Definition TransitionExperiment.h:356