OpenStructure
entity_io_mae_handler.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_IO_ENTITY_IO_PLUGIN_MAE_H
20 #define OST_IO_ENTITY_IO_PLUGIN_MAE_H
21 
22 #include <ost/mol/entity_handle.hh>
23 #include <ost/mol/chain_handle.hh>
26 
27 #include <boost/iostreams/filtering_stream.hpp>
28 #include <boost/filesystem/fstream.hpp>
29 
30 namespace ost { namespace io {
31 
33 public:
34  MAEReader(const boost::filesystem::path& loc);
35 
37 
38 private:
39 
40  void parse_and_add_atom(mol::EntityHandle ent,
41  mol::XCSEditor& editor,
42  char* line,
43  size_t line_len,
44  int i_atom_name,
45  int i_atom_xpos,
46  int i_atom_ypos,
47  int i_atom_zpos,
48  int i_res_name,
49  int i_res_num,
50  int i_chain_name);
51 
52  mol::ChainHandle curr_chain_;
53  mol::ResidueHandle curr_residue_;
54  int chain_count_;
55  int residue_count_;
56  int atom_count_;
57  boost::filesystem::ifstream infile_;
58  boost::iostreams::filtering_stream<boost::iostreams::input> in_;
59 };
60 
62 public:
63  virtual void Import(mol::EntityHandle& ent, const boost::filesystem::path& loc);
64 
65  virtual void Export(const mol::EntityView& ent,
66  const boost::filesystem::path& loc) const;
67 
68  virtual void Import(mol::EntityHandle& ent, std::istream& stream);
69 
70  virtual void Export(const mol::EntityView& ent, std::ostream& stream) const;
71 
72  static bool ProvidesImport(const boost::filesystem::path& loc,
73  const String& format="auto");
74  static bool ProvidesExport(const boost::filesystem::path& loc,
75  const String& format="auto");
76  virtual bool RequiresProcessor() const;
77 
78  static String GetFormatName() { return String("Mae"); }
79  static String GetFormatDescription() { return String("MAEstro coordinate file format"); }
80 };
81 
82 
84 
86 
87 }} // ns
88 
89 #endif
pure abstract base class for entity io handlers
static bool ProvidesImport(const boost::filesystem::path &loc, const String &format="auto")
static bool ProvidesExport(const boost::filesystem::path &loc, const String &format="auto")
virtual void Export(const mol::EntityView &ent, const boost::filesystem::path &loc) const
virtual void Import(mol::EntityHandle &ent, const boost::filesystem::path &loc)
virtual void Export(const mol::EntityView &ent, std::ostream &stream) const
virtual bool RequiresProcessor() const
virtual void Import(mol::EntityHandle &ent, std::istream &stream)
void Import(mol::EntityHandle &ent)
MAEReader(const boost::filesystem::path &loc)
linear chain of residues
Definition: chain_handle.hh:52
Protein or molecule.
definition of EntityView
Definition: entity_view.hh:86
external coordinate system editor
Definition: xcs_editor.hh:36
#define DLLEXPORT_OST_IO
std::string String
Definition: base.hh:54
mol::EntityHandle DLLEXPORT_OST_IO LoadMAE(const String &file_name)
EntityIOHandlerFactory< EntityIOMAEHandler > EntityIOMAEHandlerFactory
Definition: base.dox:1