| [3ae731] | 1 | /*
 | 
|---|
 | 2 |  * PdbParser.hpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  Created on: Aug 17, 2010
 | 
|---|
 | 5 |  *      Author: heber
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | #ifndef PDBPARSER_HPP_
 | 
|---|
 | 9 | #define PDBPARSER_HPP_
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | #include <string>
 | 
|---|
| [4fbca9c] | 12 | #include "FormatParser.hpp"
 | 
|---|
 | 13 | #include "PdbAtomInfoContainer.hpp"
 | 
|---|
 | 14 | #include "PdbKey.hpp"
 | 
|---|
| [3ae731] | 15 | 
 | 
|---|
 | 16 | /**
 | 
|---|
| [4fbca9c] | 17 |  * Loads a PDB format 3.2 file into the World and saves the World as a PDB file.
 | 
|---|
| [3ae731] | 18 |  */
 | 
|---|
 | 19 | class PdbParser : public FormatParser
 | 
|---|
 | 20 | {
 | 
|---|
 | 21 | public:
 | 
|---|
 | 22 |   PdbParser();
 | 
|---|
 | 23 |   ~PdbParser();
 | 
|---|
 | 24 |   void load(std::istream* file);
 | 
|---|
 | 25 |   void save(std::ostream* file);
 | 
|---|
 | 26 | 
 | 
|---|
| [4fbca9c] | 27 |   bool operator==(const PdbParser& b) const;
 | 
|---|
 | 28 |   void printAtomInfo(const atom *newAtom) const;
 | 
|---|
| [3ae731] | 29 | 
 | 
|---|
 | 30 | private:
 | 
|---|
| [4fbca9c] | 31 |   enum PdbKey::KnownTokens getToken(string &line);
 | 
|---|
 | 32 |   void readAtomDataLine(string &line, molecule *newmol);
 | 
|---|
| [3ae731] | 33 |   void parseAtomDataKeysLine(string line, int offset);
 | 
|---|
| [4fbca9c] | 34 |   void readNeighbors(std::string &line);
 | 
|---|
 | 35 | //  void adaptImprData();
 | 
|---|
 | 36 | //  void adaptTorsion();
 | 
|---|
 | 37 | //  std::string adaptIdDependentDataString(std::string data);
 | 
|---|
| [3ae731] | 38 |   bool isUsedField(std::string fieldName);
 | 
|---|
 | 39 |   void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom);
 | 
|---|
| [bb6193] | 40 |   void saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResdueNo);
 | 
|---|
| [4fbca9c] | 41 | 
 | 
|---|
 | 42 |   // internal getter and setter
 | 
|---|
 | 43 |   size_t getSerial(const size_t atomid) const;
 | 
|---|
 | 44 |   size_t getAtomId(const size_t atomid) const;
 | 
|---|
 | 45 |   void setAtomId(const size_t localatomid, const size_t atomid);
 | 
|---|
| [3ae731] | 46 | 
 | 
|---|
 | 47 |   /**
 | 
|---|
 | 48 |    * Map to associate the known keys with numbers.
 | 
|---|
 | 49 |    */
 | 
|---|
| [4fbca9c] | 50 |   std::map<std::string, PdbKey::KnownTokens> knownTokens;
 | 
|---|
| [3ae731] | 51 | 
 | 
|---|
 | 52 |   /**
 | 
|---|
 | 53 |    * Data which is currently not stored in atoms but was provided by the input
 | 
|---|
 | 54 |    * file.
 | 
|---|
 | 55 |    */
 | 
|---|
| [4fbca9c] | 56 |   std::map<size_t, PdbAtomInfoContainer> additionalAtomData;
 | 
|---|
| [3ae731] | 57 | 
 | 
|---|
 | 58 |   /**
 | 
|---|
 | 59 |    * Default additional atom data.
 | 
|---|
 | 60 |    */
 | 
|---|
| [bb6193] | 61 |   PdbAtomInfoContainer defaultAdditionalData;
 | 
|---|
| [3ae731] | 62 | 
 | 
|---|
 | 63 |   /**
 | 
|---|
 | 64 |    * Maps original atom IDs received from the parsed file to atom IDs in the
 | 
|---|
 | 65 |    * world.
 | 
|---|
 | 66 |    */
 | 
|---|
| [4fbca9c] | 67 |   std::map<size_t, size_t> atomIdMap;
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 |   /**
 | 
|---|
 | 70 |    * Maps original atom IDs received from the parsed file to atom IDs in the
 | 
|---|
 | 71 |    * world.
 | 
|---|
 | 72 |    */
 | 
|---|
 | 73 |   std::set<size_t> SerialSet;
 | 
|---|
 | 74 | 
 | 
|---|
| [3ae731] | 75 | };
 | 
|---|
 | 76 | 
 | 
|---|
 | 77 | #endif /* PDBPARSER_HPP_ */
 | 
|---|