ProteoWizard
Serializer_Text.hpp
Go to the documentation of this file.
1 //
2 // $Id$
3 //
4 //
5 // Original author: Robert Burke <robert.burke@proteowizard.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 
24 #ifndef _SERIALIZER_TEXT_HPP_
25 #define _SERIALIZER_TEXT_HPP_
26 
30 
31 namespace pwiz {
32 namespace identdata {
33 
34 /// \class Serializer_Text
35 ///
36 /// Serializer_Text reads in and writes out an id file in tab format.
37 ///
39 {
40 public:
41  /// List of fields available.
42  enum IdField
43  {
44  None=0,
45  Scan=1,
46  Rt=2,
47  Mz=3,
48  Charge=4,
49  Score=5,
50  ScoreType=6,
53  ProteinDescription=9,
54  Last=ProteinDescription
55  };
56 
57  static const std::string* getIdFieldNames();
58 
59  struct PWIZ_API_DECL Config ///< Controls the format of the text file.
60  {
61  bool headers;
62  std::vector<IdField> fields;
64 
65  std::string recordDelim;
66  std::string fieldDelim;
67 
68  Config();
69  Config(const Config& config);
70  };
71 
72  /// Constructor with Config
73  Serializer_Text(const Config& config = Config());
74 
75  /// writes IdentData object to ostream as a text table
76  void write(std::ostream& os, const IdentData& mzid,
77  const pwiz::util::IterationListenerRegistry* iterationListenerRegistry = 0) const;
78 
79  /// read in IdentData object from a delimited text fromat.
80  void read(boost::shared_ptr<std::istream> is, IdentData& mzid) const;
81 
82  private:
83  class Impl;
84  boost::shared_ptr<Impl> impl_;
86  Serializer_Text& operator=(Serializer_Text&);
87 };
88 
89 
90 } // namespace identdata
91 } // namespace pwiz
92 
93 #endif // _SERIALIZER_TEXT_HPP_
IterationListener.hpp
pwiz
Definition: ChromatogramList_Filter.hpp:36
pwiz::identdata::Serializer_Text::Config::fields
std::vector< IdField > fields
Definition: Serializer_Text.hpp:62
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
pwiz::identdata::IO::write
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
pwiz::identdata::Serializer_Text
Definition: Serializer_Text.hpp:38
Export.hpp
pwiz::identdata::Serializer_Text::IdField
IdField
List of fields available.
Definition: Serializer_Text.hpp:42
pwiz::identdata::Peptide
Implementation of PeptideType from the mzIdentML schema.
Definition: IdentData.hpp:368
IdentData.hpp
pwiz::identdata::Serializer_Text::Config::headers
bool headers
Definition: Serializer_Text.hpp:61
pwiz::util::IterationListenerRegistry
handles registration of IterationListeners and broadcast of update messages
Definition: IterationListener.hpp:65
pwiz::identdata::IdentData
Implementation of the MzIdentMLType from the mzIdentML schema.
Definition: IdentData.hpp:993
pwiz::identdata::Serializer_Text::Config
< Controls the format of the text file.
Definition: Serializer_Text.hpp:59
pwiz::proteome::Protein
Definition: ProteomeData.hpp:36
pwiz::identdata::Serializer_Text::impl_
boost::shared_ptr< Impl > impl_
Definition: Serializer_Text.hpp:83
pwiz::identdata::Serializer_Text::Config::recordDelim
std::string recordDelim
Definition: Serializer_Text.hpp:65
pwiz::identdata::Serializer_Text::Config::fieldDelim
std::string fieldDelim
Definition: Serializer_Text.hpp:66
pwiz::identdata::Serializer_Text::Config::sort
IdField sort
Definition: Serializer_Text.hpp:63
pwiz::identdata::IO::read
PWIZ_API_DECL void read(std::istream &is, CV &cv)