ProteoWizard
ProteinList_DecoyGenerator.hpp
Go to the documentation of this file.
1 //
2 // $Id$
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
6 //
7 // Copyright 2010 Vanderbilt University - Nashville, TN 37232
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 //
21 
22 
23 #ifndef _PROTEINLIST_DECOYGENERATOR_HPP_
24 #define _PROTEINLIST_DECOYGENERATOR_HPP_
25 
26 
29 #include <boost/cstdint.hpp>
30 
31 
32 namespace pwiz {
33 namespace analysis {
34 
35 
36 using namespace pwiz::proteome;
37 
38 
39 /// ProteinList decoy generator for creating decoy proteins on the fly
41 {
42  public:
43 
44  /// client-implemented generator predicate -- called during construction of
45  /// ProteinList_DecoyGenerator to create a decoy protein from a target protein
47  {
48  /// return a decoy protein based on an input target protein
49  virtual ProteinPtr generate(const Protein& protein) const = 0;
50 
51  /// return the string prefixed to a protein id to indicate it is a decoy
52  virtual const std::string& decoyPrefix() const {return decoyPrefix_;}
53 
54  virtual ~Predicate() {}
55 
56  protected:
57  std::string decoyPrefix_;
58  };
59 
60  typedef boost::shared_ptr<Predicate> PredicatePtr;
61 
62  ProteinList_DecoyGenerator(const ProteinListPtr& original, const PredicatePtr& predicate);
63 
64  /// \name ProteinList interface
65  //@{
66  virtual size_t size() const;
67  virtual size_t find(const std::string& id) const;
68  virtual ProteinPtr protein(size_t index, bool getSequence = true) const;
69  //@}
70 
71  private:
72  struct Impl;
73  boost::shared_ptr<Impl> impl_;
76 };
77 
78 
79 /// creates a reversed copy of every target protein with the specified decoy string prefixed to the id
81 {
82  public:
83  ProteinList_DecoyGeneratorPredicate_Reversed(const std::string& decoyPrefix);
84 
85  virtual ProteinPtr generate(const Protein& protein) const;
86 };
87 
88 
89 /// creates a randomly shuffled copy of every target protein with the specified decoy string prefixed to the id
91 {
92  public:
93  ProteinList_DecoyGeneratorPredicate_Shuffled(const std::string& decoyPrefix, boost::uint32_t randomSeed = 0u);
94 
95  virtual ProteinPtr generate(const Protein& protein) const;
96 
97  private:
98  struct Impl;
99  boost::shared_ptr<Impl> impl_;
100 };
101 
102 
103 } // namespace analysis
104 } // namespace pwiz
105 
106 
107 #endif // _PROTEINLIST_DECOYGENERATOR_HPP_
pwiz::proteome::ProteinListWrapper
Inheritable pass-through implementation for wrapping a ProteinList.
Definition: ProteinListWrapper.hpp:37
pwiz
Definition: ChromatogramList_Filter.hpp:36
pwiz::analysis::ProteinList_DecoyGenerator::impl_
boost::shared_ptr< Impl > impl_
Definition: ProteinList_DecoyGenerator.hpp:72
ralab::base::filter::uint32_t
boost::uint32_t uint32_t
Definition: filter.hpp:47
pwiz::analysis::ProteinList_DecoyGenerator::Predicate::~Predicate
virtual ~Predicate()
Definition: ProteinList_DecoyGenerator.hpp:54
pwiz::proteome
Definition: AminoAcid.hpp:35
pwiz::analysis::ProteinList_DecoyGenerator
ProteinList decoy generator for creating decoy proteins on the fly.
Definition: ProteinList_DecoyGenerator.hpp:40
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
pwiz::analysis::ProteinList_DecoyGeneratorPredicate_Shuffled::impl_
boost::shared_ptr< Impl > impl_
Definition: ProteinList_DecoyGenerator.hpp:98
Export.hpp
pwiz::analysis::ProteinList_DecoyGenerator::PredicatePtr
boost::shared_ptr< Predicate > PredicatePtr
Definition: ProteinList_DecoyGenerator.hpp:60
ProteinListWrapper.hpp
pwiz::analysis::ProteinList_DecoyGeneratorPredicate_Reversed
creates a reversed copy of every target protein with the specified decoy string prefixed to the id
Definition: ProteinList_DecoyGenerator.hpp:80
pwiz::proteome::ProteinListPtr
boost::shared_ptr< ProteinList > ProteinListPtr
Definition: ProteomeData.hpp:73
pwiz::proteome::Protein
Definition: ProteomeData.hpp:36
pwiz::analysis::ProteinList_DecoyGeneratorPredicate_Shuffled
creates a randomly shuffled copy of every target protein with the specified decoy string prefixed to ...
Definition: ProteinList_DecoyGenerator.hpp:90
pwiz::analysis::ProteinList_DecoyGenerator::Predicate
client-implemented generator predicate – called during construction of ProteinList_DecoyGenerator to ...
Definition: ProteinList_DecoyGenerator.hpp:46
pwiz::analysis::ProteinList_DecoyGenerator::Predicate::decoyPrefix_
std::string decoyPrefix_
Definition: ProteinList_DecoyGenerator.hpp:57
pwiz::analysis::ProteinList_DecoyGenerator::Predicate::decoyPrefix
virtual const std::string & decoyPrefix() const
return the string prefixed to a protein id to indicate it is a decoy
Definition: ProteinList_DecoyGenerator.hpp:52
pwiz::proteome::ProteinPtr
boost::shared_ptr< Protein > ProteinPtr
Definition: ProteomeData.hpp:48