ProteoWizard
PeptideID_flat.hpp
Go to the documentation of this file.
1 //
2 // $Id$
3 //
4 //
5 // Original author: Robert Burke <robert.burke@cshs.org>
6 //
7 // Copyright 2007 Spielberg Family Center for Applied Proteomics
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 #ifndef _PEPTIDEID_FLAT_HPP_
24 #define _PEPTIDEID_FLAT_HPP_
25 
26 #include <map>
27 #include <vector>
28 #include <string>
29 #include <iostream>
30 #include <boost/shared_ptr.hpp>
31 
33 #include "PeptideID.hpp"
34 
35 namespace pwiz {
36 namespace peptideid {
37 
39 {
40 public:
41  virtual ~FlatRecordBuilder() {}
42 
43  virtual PeptideID::Record build(const std::vector<std::string>& fields) const;
44 
45  virtual bool header() const;
46 
47  virtual double epsilon() const;
48 
49  virtual bool operator()(const PeptideID::Record& a, const PeptideID::Record& b) const;
50 
51  virtual bool operator()(const PeptideID::Record& a, const PeptideID::Location& ) const;
52 };
53 
55 {
56 public:
58 
59  virtual PeptideID::Record build(const std::vector<std::string>& fields) const;
60 
61  virtual bool header() const;
62 
63  virtual double epsilon() const;
64 
65  virtual bool operator()(const PeptideID::Record& a, const PeptideID::Record& b) const;
66 
67  virtual bool operator()(const PeptideID::Record& a, const PeptideID::Location& ) const;
68 };
69 
70 /// This class allows access to peptides listed in a flat tab
71 /// delimited text file
72 
73 /// A PeptideID_flat object is contructed with either the path to a
74 /// tab delimited file (*.txt/*.tab), or an std::istream open to
75 /// the beginning of a tab delimited file.
76 
78 {
79 public:
80  /// Constructor taking path to input file in std::string.
81  PeptideID_flat(const std::string& filename,
82  boost::shared_ptr<FlatRecordBuilder> builder =
83  boost::shared_ptr<FlatRecordBuilder>(new FlatRecordBuilder()));
84 
85  /// Constructor taking std::istream as input.
86  PeptideID_flat(std::istream* in,
87  boost::shared_ptr<FlatRecordBuilder> builder =
88  boost::shared_ptr<FlatRecordBuilder>(new FlatRecordBuilder()));
89 
90  /// Destructor.
91  virtual ~PeptideID_flat() {}
92 
93  /// Returns the Record object associated with the given nativeID.
94 
95  /// A range_error is thrown if the nativeID isn't associated with
96  /// a Record.
97  virtual Record record(const Location& location) const;
98 
99  virtual Iterator begin() const;
100  virtual Iterator end() const;
101 
102 private:
103  class Impl;
104  boost::shared_ptr<Impl> pimpl;
105 };
106 
107 } // namespace peptideid
108 } // namespace pwiz
109 
110 #endif // _PEPTIDEID_FLAT_HPP_
pwiz::peptideid::PeptideID_flat::~PeptideID_flat
virtual ~PeptideID_flat()
Destructor.
Definition: PeptideID_flat.hpp:91
pwiz::peptideid::PeptideID_flat::PeptideID_flat
PeptideID_flat(const std::string &filename, boost::shared_ptr< FlatRecordBuilder > builder=boost::shared_ptr< FlatRecordBuilder >(new FlatRecordBuilder()))
Constructor taking path to input file in std::string.
pwiz
Definition: ChromatogramList_Filter.hpp:36
pwiz::peptideid::MSInspectRecordBuilder::operator()
virtual bool operator()(const PeptideID::Record &a, const PeptideID::Location &) const
pwiz::peptideid::PeptideID::Location
Definition: PeptideID.hpp:47
pwiz::peptideid::FlatRecordBuilder::epsilon
virtual double epsilon() const
pwiz::peptideid::MSInspectRecordBuilder::build
virtual PeptideID::Record build(const std::vector< std::string > &fields) const
pwiz::peptideid::FlatRecordBuilder::~FlatRecordBuilder
virtual ~FlatRecordBuilder()
Definition: PeptideID_flat.hpp:41
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
pwiz::peptideid::MSInspectRecordBuilder
Definition: PeptideID_flat.hpp:55
pwiz::peptideid::MSInspectRecordBuilder::~MSInspectRecordBuilder
virtual ~MSInspectRecordBuilder()
Definition: PeptideID_flat.hpp:57
pwiz::peptideid::PeptideID_flat::PeptideID_flat
PeptideID_flat(std::istream *in, boost::shared_ptr< FlatRecordBuilder > builder=boost::shared_ptr< FlatRecordBuilder >(new FlatRecordBuilder()))
Constructor taking std::istream as input.
pwiz::peptideid::MSInspectRecordBuilder::epsilon
virtual double epsilon() const
Export.hpp
pwiz::peptideid::PeptideID
This is an interface for classes that allow access to data sources of identified peptides.
Definition: PeptideID.hpp:43
pwiz::peptideid::FlatRecordBuilder
Definition: PeptideID_flat.hpp:39
pwiz::peptideid::PeptideID::Iterator
Iterator for.
Definition: PeptideID.hpp:94
pwiz::peptideid::PeptideID_flat
This class allows access to peptides listed in a flat tab delimited text file.
Definition: PeptideID_flat.hpp:78
pwiz::peptideid::FlatRecordBuilder::operator()
virtual bool operator()(const PeptideID::Record &a, const PeptideID::Location &) const
pwiz::peptideid::FlatRecordBuilder::header
virtual bool header() const
pwiz::peptideid::PeptideID_flat::end
virtual Iterator end() const
pwiz::peptideid::MSInspectRecordBuilder::operator()
virtual bool operator()(const PeptideID::Record &a, const PeptideID::Record &b) const
pwiz::peptideid::PeptideID_flat::begin
virtual Iterator begin() const
pwiz::peptideid::PeptideID::Record
Definition: PeptideID.hpp:59
pwiz::peptideid::FlatRecordBuilder::build
virtual PeptideID::Record build(const std::vector< std::string > &fields) const
pwiz::peptideid::MSInspectRecordBuilder::header
virtual bool header() const
pwiz::peptideid::PeptideID_flat::pimpl
boost::shared_ptr< Impl > pimpl
Definition: PeptideID_flat.hpp:103
pwiz::peptideid::FlatRecordBuilder::operator()
virtual bool operator()(const PeptideID::Record &a, const PeptideID::Record &b) const
PeptideID.hpp
pwiz::peptideid::PeptideID_flat::record
virtual Record record(const Location &location) const
Returns the Record object associated with the given nativeID.