ProteoWizard
ProteomeData.hpp
Go to the documentation of this file.
1 //
2 // $Id: ProteomeData.hpp 1623 2009-12-17 20:58:35Z chambm $
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
6 //
7 // Copyright 2009 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 _PROTEOMEDATA_HPP_
24 #define _PROTEOMEDATA_HPP_
25 
26 
28 #include "Peptide.hpp"
29 #include <boost/shared_ptr.hpp>
30 
31 
32 namespace pwiz {
33 namespace proteome {
34 
35 
36 struct PWIZ_API_DECL Protein : public Peptide
37 {
38  Protein(const std::string& id, size_t index, const std::string& description, const std::string& sequence);
39 
40  bool empty() const;
41 
42  std::string id;
43  size_t index;
44  std::string description;
45 };
46 
47 
48 typedef boost::shared_ptr<Protein> ProteinPtr;
49 
50 
51 // note: derived container to support dynamic linking on Windows
52 class IndexList : public std::vector<size_t> {};
53 
54 
56 {
57  public:
58 
59  virtual size_t size() const = 0;
60 
61  virtual ProteinPtr protein(size_t index, bool getSequence = true) const = 0;
62 
63  virtual bool empty() const;
64 
65  virtual size_t find(const std::string& id) const;
66 
67  virtual IndexList findKeyword(const std::string& keyword, bool caseSensitive = true) const;
68 
69  virtual ~ProteinList() {}
70 };
71 
72 
73 typedef boost::shared_ptr<ProteinList> ProteinListPtr;
74 
75 
77 {
78  std::vector<ProteinPtr> proteins;
79 
80  // ProteinList implementation
81 
82  virtual size_t size() const {return proteins.size();}
83  virtual bool empty() const {return proteins.empty();}
84  virtual ProteinPtr protein(size_t index, bool getSequence = true) const;
85 };
86 
87 
89 {
90  std::string id;
91 
93 
95  virtual ~ProteomeData() {}
96  bool empty() const;
97 
98  private:
99  // no copying
100  ProteomeData(const ProteomeData&);
101  ProteomeData& operator=(const ProteomeData&);
102 };
103 
104 
105 } // namespace proteome
106 } // namespace pwiz
107 
108 
109 #endif // _PROTEOMEDATA_HPP_