ProteoWizard
IPIFASTADatabase.hpp
Go to the documentation of this file.
1 //
2 // $Id: IPIFASTADatabase.hpp 1407 2009-10-10 17:07:39Z paragmallick $
3 //
4 //
5 // Original author: Darren Kessner <darren@proteowizard.org>
6 //
7 // Copyright 2006 Louis Warschaw Prostate Cancer Center
8 // Cedars Sinai Medical Center, Los Angeles, California 90048
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 //
22 
23 
24 #ifndef _IPIFASTADATABASE_HPP_
25 #define _IPIFASTADATABASE_HPP_
26 
27 
29 #include <memory>
30 #include <string>
31 #include <vector>
32 #include <iosfwd>
33 
34 
35 namespace pwiz {
36 namespace proteome {
37 
38 
39 /// class for accessing data in ipi.*.fasta files
41 {
42  public:
43 
44  /// constructor reads in entire file
45  IPIFASTADatabase(const std::string& filename);
47 
48  /// structure for holding peptide info
50  {
51  int id;
52  std::string faID;
53  std::string fullSeqDescription;
54  std::string sequence;
55 
56  Record(int _id=0) : id(_id) {}
57  };
58 
59 
60  /// access to the data in memory
61  const std::vector<Record>& records() const;
62 
63  /// typedef to simplify declaration of Record iterator
64  typedef std::vector<Record>::const_iterator const_iterator;
65 
66  // begin() and end()
67  const_iterator begin();
68  const_iterator end();
69 
70  private:
71  class Impl;
72  std::auto_ptr<Impl> impl_;
73 };
74 
75 
76 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const IPIFASTADatabase::Record& record);
77 
78 
79 } // namespace proteome
80 } // namespace pwiz
81 
82 
83 #endif // _IPIFASTADATABASE_HPP_
84