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
17
18
19#include <string>
20#include <utility> // for pair
21#include <vector>
22#include <map>
23
24// #define DEBUG_MRMDECOY
25
26namespace OpenMS
27{
57 class OPENMS_DLLAPI MRMDecoy :
59 public ProgressLogger
60 {
61
62public:
63
64 typedef std::vector<size_t> IndexType;
65
67
113 const std::string& method,
114 const double aim_decoy_fraction,
115 const bool switchKR,
116 const std::string& decoy_tag,
117 const int max_attempts,
118 const double identity_threshold,
119 const double precursor_mz_shift,
120 const double product_mz_shift,
121 const double product_mz_threshold,
122 const std::vector<std::string>& fragment_types,
123 const std::vector<size_t>& fragment_charges,
124 const bool enable_specific_losses,
125 const bool enable_unspecific_losses,
126 const int round_decPow = -4,
127 const Int shuffle_seed = 1) const;
128
158 const std::string& method,
159 const double aim_decoy_fraction,
160 const bool switchKR,
161 const std::string& decoy_tag,
162 const int max_attempts,
163 const double identity_threshold,
164 const double precursor_mz_shift,
165 const double product_mz_shift,
166 const double product_mz_threshold,
167 const std::vector<std::string>& fragment_types,
168 const std::vector<size_t>& fragment_charges,
169 const bool enable_specific_losses,
170 const bool enable_unspecific_losses,
171 const int round_decPow = -4,
172 const Int shuffle_seed = 1) const;
173
181
182 typedef std::vector<OpenMS::TargetedExperiment::Protein> ProteinVectorType;
183 typedef std::vector<OpenMS::TargetedExperiment::Peptide> PeptideVectorType;
184 typedef std::vector<OpenMS::ReactionMonitoringTransition> TransitionVectorType;
185
186 typedef std::map<std::string, std::vector<const ReactionMonitoringTransition*> > PeptideTransitionMapType;
187
192 float AASequenceIdentity(const std::string& sequence, const std::string& decoy) const;
193
203 const double identity_threshold,
204 int seed = -1,
205 const int max_attempts = 100) const;
206
217 const bool keepN,
218 const bool keepC,
219 const std::string& const_pattern = std::string());
220
229 static IndexType findFixedResidues(const std::string& sequence,
230 bool keepN, bool keepC, const std::string& keep_const_pattern);
231
245 static std::pair<std::string, std::vector<OpenSwath::LightModification>> reversePeptideLight(
246 const std::string& sequence,
247 const std::vector<OpenSwath::LightModification>& modifications,
248 bool keepN,
249 bool keepC,
250 const std::string& const_pattern = std::string());
251
265 std::pair<std::string, std::vector<OpenSwath::LightModification>> shufflePeptideLight(
266 const std::string& sequence,
267 const std::vector<OpenSwath::LightModification>& modifications,
268 double identity_threshold,
269 int seed = -1,
270 int max_attempts = 100) const;
271
280 static void switchKRLight(std::string& sequence);
281
282protected:
283
287 bool hasCNterminalMods_(const OpenMS::TargetedExperiment::Peptide& peptide, bool checkCterminalAA) const;
288
300 const std::vector<OpenSwath::LightModification>& modifications,
301 size_t sequence_length,
302 bool checkCterminalAA);
303
313 std::pair<std::string, std::vector<OpenSwath::LightModification>> pseudoreversePeptideLight_(
314 const std::string& sequence,
315 const std::vector<OpenSwath::LightModification>& modifications) const;
316
322 IndexType findFixedResidues_(const std::string& sequence) const;
323
329 IndexType findFixedAndTermResidues_(const std::string& sequence) const;
330
338 const OpenMS::TargetedExperiment::Peptide& peptide) const;
339
346 const OpenMS::TargetedExperiment::Peptide& peptide) const;
347
352
354 void updateMembers_() override;
355
357 bool keepN_;
358 bool keepC_;
359 };
360}
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:60
std::vector< size_t > IndexType
Definition MRMDecoy.h:64
std::string getModifiedPeptideSequence_(const OpenMS::TargetedExperiment::Peptide &pep) const
Convert a peptide to a string which contains the peptide sequence and modifications.
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.
void generateDecoys(const OpenMS::TargetedExperiment &exp, OpenMS::TargetedExperiment &dec, const std::string &method, const double aim_decoy_fraction, const bool switchKR, const std::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< std::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 Int shuffle_seed=1) const
Generate decoys from a TargetedExperiment.
IndexType findFixedResidues_(const std::string &sequence) const
Find all K, R, P sites in a sequence to be set as fixed.
std::map< std::string, std::vector< const ReactionMonitoringTransition * > > PeptideTransitionMapType
Definition MRMDecoy.h:186
bool keepC_
Definition MRMDecoy.h:358
static void switchKRLight(std::string &sequence)
Switch the final amino acid of a tryptic peptide (light version)
std::vector< OpenMS::ReactionMonitoringTransition > TransitionVectorType
Definition MRMDecoy.h:184
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:183
float AASequenceIdentity(const std::string &sequence, const std::string &decoy) const
Compute relative identity (relative number of matches of amino acids at the same position) between tw...
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 std::string &const_pattern=std::string())
Reverse a peptide sequence (light version operating on strings)
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:357
std::vector< OpenMS::TargetedExperiment::Protein > ProteinVectorType
Definition MRMDecoy.h:182
void updateMembers_() override
Synchronize members with param class.
void generateDecoysLight(const OpenSwath::LightTargetedExperiment &exp, OpenSwath::LightTargetedExperiment &dec, const std::string &method, const double aim_decoy_fraction, const bool switchKR, const std::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< std::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 Int shuffle_seed=1) const
Generate decoys from a LightTargetedExperiment (memory-efficient version)
static IndexType findFixedResidues(const std::string &sequence, bool keepN, bool keepC, const std::string &keep_const_pattern)
Find all residues in a sequence that should not be reversed / shuffled.
bool hasCNterminalMods_(const OpenMS::TargetedExperiment::Peptide &peptide, bool checkCterminalAA) const
Check if a peptide has C or N terminal modifications.
static OpenMS::TargetedExperiment::Peptide reversePeptide(const OpenMS::TargetedExperiment::Peptide &peptide, const bool keepN, const bool keepC, const std::string &const_pattern=std::string())
Reverse a peptide sequence (with its modifications)
std::string keep_const_pattern_
Definition MRMDecoy.h:356
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)
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:28
Represents a peptide (amino acid sequence)
Definition TargetedExperimentHelper.h:334
A description of a targeted experiment containing precursor and production ions.
Definition TargetedExperiment.h:40
int Int
Signed integer type.
Definition Types.h:72
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Definition TransitionExperiment.h:369