pdb_system.hpp

Go to the documentation of this file.
00001 // -*- mode: c++; indent-tabs-mode: nil; -*-
00002 //
00003 //The Biomolecule Toolkit (BTK) is a C++ library for use in the
00004 //modeling, analysis, and design of biological macromolecules.
00005 //Copyright (C) 2005-2006, Tim Robertson <kid50@users.sourceforge.net>
00006 //
00007 //This program is free software; you can redistribute it and/or modify
00008 //it under the terms of the GNU Lesser General Public License as published
00009 //by the Free Software Foundation; either version 2.1 of the License, or (at
00010 //your option) any later version.
00011 //
00012 //This program is distributed in the hope that it will be useful,  but
00013 //WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //Lesser General Public License for more details.
00016 //
00017 //You should have received a copy of the GNU Lesser General Public License
00018 //along with this program; if not, write to the Free Software Foundation,
00019 //Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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 } // namespace IO
00164 } // namespace BTK
00165 
00166 #endif

Generated on Sun Jul 15 20:46:26 2007 for BTK Core by  doxygen 1.5.1