00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00023
00024 #ifndef BTK_IO_PDB_SYSTEM_HPP
00025 #define BTK_IO_PDB_SYSTEM_HPP
00026
00027 #include <btk/core/io/pdb_file_parser.hpp>
00028 #include <btk/core/molecules/system.hpp>
00029
00030 namespace BTK {
00031 namespace IO {
00032
00033 template <typename PolymerType,
00034 typename ChemicalTypeSystemType =
00035 typename PolymerType::chemical_type_system,
00036 typename StorageStrategy = std::list<PolymerType> >
00037 class PDBSystem :
00038 public BTK::MOLECULES::System<PolymerType,
00039 ChemicalTypeSystemType,
00040 StorageStrategy>
00041 {
00042 typedef PDBSystem<PolymerType,
00043 ChemicalTypeSystemType,
00044 StorageStrategy> self_type;
00045
00046 typedef BTK::MOLECULES::System<PolymerType,
00047 ChemicalTypeSystemType,
00048 StorageStrategy> base_type;
00049 public:
00050 IMPORT_BTK_SYSTEM_TYPES(base_type);
00051
00055
00056
00066 PDBSystem(std::string const & filename,
00067 int which_model,
00068 bool load_hetatoms = true,
00069 bool dynamic_types = true,
00070 chemical_type_system const & cts = chemical_type_system()) :
00071 base_type(cts),
00072 _file_parser(filename,which_model,cts,dynamic_types)
00073 {
00074 _file_parser.get_model(which_model,*this,load_hetatoms);
00075 }
00076
00085 PDBSystem(std::string const & filename,
00086 bool load_hetatoms = true,
00087 bool dynamic_types = true,
00088 chemical_type_system const & cts = chemical_type_system()) :
00089 base_type(cts),
00090 _file_parser(filename,0,cts,dynamic_types)
00091 {
00092 _file_parser.get_current_model(*this,load_hetatoms);
00093 }
00095
00100
00101
00103 PDBSystem(size_type n = 0,
00104 const_reference t = chain_type()) :
00105 base_type(n,t) {}
00106
00108 template <typename ChainIterator>
00109 PDBSystem(ChainIterator begin,
00110 ChainIterator end) :
00111 base_type(begin,end) {}
00113
00115 PDBSystem(PDBSystem const & src) :
00116 base_type(src), _file_parser(src._file_parser) {}
00117
00119 virtual ~PDBSystem()
00120 {
00121 }
00122
00125 bool open(std::string filename,
00126 int which_model = 0)
00127 {
00128 return _file_parser.open(filename,which_model);
00129 }
00130
00133 void close()
00134 {
00135 _file_parser.close();
00136 }
00137
00139 std::string const & header() const { return _file_parser.get_header(); }
00140
00142 std::string const & filename() const { return _file_parser.get_filename(); }
00143
00146 bool get_model(int which,
00147 bool load_hetatoms = true)
00148 {
00149 return _file_parser.get_model(which,*this,load_hetatoms);
00150 }
00151
00154 bool get_next_model(bool load_hetatoms = true)
00155 {
00156 return _file_parser.get_next_model(*this,load_hetatoms);
00157 }
00158
00159 private:
00160 PDBFileParser<chemical_type_system> _file_parser;
00161 };
00162
00163 }
00164 }
00165
00166 #endif