OpenMS  3.0.0
DecoyGenerator.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: Timo Sachsenberg $
32 // $Authors: Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <OpenMS/CONCEPT/Types.h>
39 
40 namespace OpenMS
41 {
42  class AASequence;
43  class DigestionEnzymeProtein;
44 
48  class OPENMS_DLLAPI DecoyGenerator
49  {
50  public:
51  // initializes random generator
53 
54  // destructor
55  ~DecoyGenerator() = default;
56 
57  // random seed for shuffling
58  void setSeed(UInt64 seed);
59 
60  /*
61  @brief reverses the protein sequence.
62  note: modifications are discarded
63  */
64  AASequence reverseProtein(const AASequence& protein) const;
65 
66  /*
67  @brief reverses the protein's peptide sequences between enzymatic cutting positions.
68  note: modifications are discarded
69  */
70  AASequence reversePeptides(const AASequence& protein, const String& protease) const;
71 
72  /*
73  @brief shuffle the protein's peptide sequences between enzymatic cutting positions.
74  each peptide is shuffled @param max_attempts times to minimize sequence identity.
75  note: modifications are discarded
76  */
77  AASequence shufflePeptides(
78  const AASequence& aas,
79  const String& protease,
80  const int max_attempts = 100
81  );
82 
83  private:
84  // sequence identity by matching AAs
85  static double SequenceIdentity_(const String& decoy, const String& target);
86 
87  // portable shuffle
89  };
90 }
91 
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:147
FileHandler.h
OpenMS::FeatureDeconvolution
An algorithm to decharge features (i.e. as found by FeatureFinder).
Definition: FeatureDeconvolution.h:60
Size
OpenMS::UInt64
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:77
OpenMS::Param::setValue
void setValue(const std::string &key, const ParamValue &value, const std::string &description="", const std::vector< std::string > &tags=std::vector< std::string >())
Sets a value.
OpenMS::Math::RandomShuffler
Definition: MathFunctions.h:363
OpenMS::ProteaseDigestion::setEnzyme
void setEnzyme(const String &name)
Sets the enzyme for the digestion (by name)
Types.h
OpenMS::Param::insert
void insert(const std::string &prefix, const Param &param)
OpenMS::DecoyGenerator
Methods to generate isobaric decoy sequences for DDA target-decoy searches.
Definition: DecoyGenerator.h:48
StopWatch.h
OpenMS::FASTAFile::FASTAEntry::identifier
String identifier
Definition: FASTAFile.h:73
OpenMS::DigestionEnzymeDB::getInstance
static InstanceType * getInstance()
this member function serves as a replacement of the constructor
Definition: DigestionEnzymeDB.h:69
OpenMS::TargetedExperimentHelper::Peptide
Represents a peptide (amino acid sequence)
Definition: TargetedExperimentHelper.h:358
OpenMS::StringUtils::reverse
static String & reverse(String &this_s)
Definition: StringUtilsSimple.h:350
OpenMS::FASTAFile
This class serves for reading in and writing FASTA files If the protein/gene sequence contains unusua...
Definition: FASTAFile.h:60
OpenMS::FASTAFile::FASTAEntry::sequence
String sequence
Definition: FASTAFile.h:75
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::String::trim
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
Int
ConsensusMap.h
FASTAContainer.h
OpenMS::FileHandler::storeConsensusFeatures
bool storeConsensusFeatures(const String &filename, const ConsensusMap &map)
Store a ConsensFeatureMap.
OpenMS::FileHandler::loadFeatures
bool loadFeatures(const String &filename, FeatureMap &map, FileTypes::Type force_type=FileTypes::UNKNOWN)
Loads a file into a FeatureMap.
OPENMS_LOG_WARN
#define OPENMS_LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged.
Definition: LogStream.h:460
OpenMS::ParamValue::toBool
bool toBool() const
Conversion to bool.
OpenMS::FASTAFile::FASTAEntry
FASTA entry type (identifier, description and sequence) The first String corresponds to the identifie...
Definition: FASTAFile.h:71
OpenMS::String::hasPrefix
bool hasPrefix(const String &string) const
true if String begins with string, false otherwise
OpenMS::DecoyHelper::affixes
static const std::vector< std::string > affixes
Definition: FASTAContainer.h:382
OPENMS_LOG_FATAL_ERROR
#define OPENMS_LOG_FATAL_ERROR
Macro to be used if fatal error are reported (processing stops)
Definition: LogStream.h:450
OpenMS::ListUtils::concatenate
static String concatenate(const std::vector< T > &container, const String &glue="")
Concatenates all elements of the container and puts the glue string between elements.
Definition: ListUtils.h:209
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::TargetedExperimentHelper::Peptide::sequence
String sequence
Definition: TargetedExperimentHelper.h:420
ProteaseDigestion.h
ProteaseDB.h
OpenMS::MRMDecoy::reversePeptide
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)
FASTAFile.h
OpenMS::DecoyHelper::countDecoys
static DecoyStatistics countDecoys(FASTAContainer< T > &proteins)
Function to count the occurrences of decoy strings in a given set of protein names.
Definition: FASTAContainer.h:472
OpenMS::FileHandler
Facilitates file handling by file type recognition.
Definition: FileHandler.h:66
FeatureMap.h
ProteinIdentification.h
MathFunctions.h
OpenMS::StopWatch::start
void start()
Start the stop watch.
OpenMS::FeatureDeconvolution::compute
void compute(const FeatureMap &fm_in, FeatureMap &fm_out, ConsensusMap &cons_map, ConsensusMap &cons_map_p)
Compute a zero-charge feature map from a set of charged features.
OpenMS::ProteaseDigestion::digest
Size digest(const AASequence &protein, std::vector< AASequence > &output, Size min_length=1, Size max_length=0) const
: Performs the enzymatic digestion of a protein.
OpenMS::StopWatch::stop
void stop()
Stop the stop watch (can be resumed later). If the stop watch was not running an exception is thrown.
OpenMS::FileHandler::storeFeatures
bool storeFeatures(const String &filename, const FeatureMap &map)
Store a FeatureMap.
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::FASTAFile::writeNext
void writeNext(const FASTAEntry &protein)
Stores the data given by protein. Call writeStart() once before calling writeNext()....
OpenMS::DefaultParamHandler::getDefaults
const Param & getDefaults() const
Non-mutable access to the default parameters.
OpenMS::String::hasSuffix
bool hasSuffix(const String &string) const
true if String ends with string, false otherwise
OpenMS::DefaultParamHandler::getParameters
const Param & getParameters() const
Non-mutable access to the parameters.
MRMDecoy.h
OpenMS::ConsensusMap
A container for consensus elements.
Definition: ConsensusMap.h:82
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::StringConversions::append
void append(const T &i, String &target)
Definition: StringConversions.h:118
OpenMS::DataProcessing::CHARGE_DECONVOLUTION
Charge deconvolution.
Definition: DataProcessing.h:61
OpenMS::FASTAFile::writeStart
void writeStart(const String &filename)
Prepares a FASTA file given by 'filename' for streamed writing using writeNext().
OpenMS::StopWatch
This class is used to determine the current process' CPU (user and/or kernel) and wall time.
Definition: StopWatch.h:65
OpenMS::IdentificationDataInternal::RNA
Definition: MetaData.h:69
FeatureDeconvolution.h
OpenMS::ParamValue::toString
std::string toString(bool full_precision=true) const
Convert ParamValue to string.
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:71
OpenMS::ConsensusMap::getColumnHeaders
const ColumnHeaders & getColumnHeaders() const
Non-mutable access to the file descriptions.
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:98
OpenMS::Param::copy
Param copy(const std::string &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
OpenMS::ProteaseDigestion
Class for the enzymatic digestion of proteins.
Definition: ProteaseDigestion.h:59
OpenMS::FASTAFile::readNext
bool readNext(FASTAEntry &protein)
Reads the next FASTA entry from file. If you want to read all entries in one go, use load().
OpenMS::FASTAFile::readStart
void readStart(const String &filename)
Prepares a FASTA file given by 'filename' for streamed reading using readNext().
DigestionEnzyme.h
OpenMS::String::reverse
String & reverse()
inverts the direction of the string
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OpenMS::AASequence
Representation of a peptide/protein sequence.
Definition: AASequence.h:111
OpenMS::DecoyGenerator::shuffler_
Math::RandomShuffler shuffler_
Definition: DecoyGenerator.h:88
OpenMS::AASequence::fromString
static AASequence fromString(const String &s, bool permissive=true)
create AASequence object by parsing an OpenMS string
OpenMS::Param::getValue
const ParamValue & getValue(const std::string &key) const
Returns a value of a parameter.
OpenMS::Internal::ClassTest::infile
std::ifstream infile
Questionable file tested by TEST_FILE_EQUAL.
TOPPBase.h
OpenMS::String::toLower
String & toLower()
Converts the string to lowercase.
OpenMS::FASTAContainer< TFI_File >
FASTAContainer<TFI_File> will make FASTA entries available chunk-wise from start to end by loading it...
Definition: FASTAContainer.h:93