[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);
|
---|
[73916f] | 25 | void save(std::ostream* file, const std::vector<atom *> &atoms);
|
---|
[3ae731] | 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);
|
---|
[16462f] | 40 | void saveLine(ostream* file, const PdbAtomInfoContainer &atomInfo);
|
---|
[4fbca9c] | 41 |
|
---|
| 42 | // internal getter and setter
|
---|
[93fd43e] | 43 | PdbAtomInfoContainer& getadditionalAtomData(atom *_atom);
|
---|
[4fbca9c] | 44 | size_t getSerial(const size_t atomid) const;
|
---|
[16462f] | 45 | void setSerial(const size_t localatomid, const size_t atomid);
|
---|
| 46 |
|
---|
| 47 | /**
|
---|
| 48 | * argh, why can't just PdbKey::X+(size_t)i
|
---|
| 49 | */
|
---|
| 50 | std::map<size_t, PdbKey::PdbDataKey> PositionEnumMap;
|
---|
[3ae731] | 51 |
|
---|
| 52 | /**
|
---|
| 53 | * Map to associate the known keys with numbers.
|
---|
| 54 | */
|
---|
[4fbca9c] | 55 | std::map<std::string, PdbKey::KnownTokens> knownTokens;
|
---|
[3ae731] | 56 |
|
---|
| 57 | /**
|
---|
| 58 | * Data which is currently not stored in atoms but was provided by the input
|
---|
| 59 | * file.
|
---|
| 60 | */
|
---|
[4fbca9c] | 61 | std::map<size_t, PdbAtomInfoContainer> additionalAtomData;
|
---|
[3ae731] | 62 |
|
---|
| 63 | /**
|
---|
| 64 | * Default additional atom data.
|
---|
| 65 | */
|
---|
[bb6193] | 66 | PdbAtomInfoContainer defaultAdditionalData;
|
---|
[3ae731] | 67 |
|
---|
| 68 | /**
|
---|
| 69 | * Maps original atom IDs received from the parsed file to atom IDs in the
|
---|
| 70 | * world.
|
---|
| 71 | */
|
---|
[4fbca9c] | 72 | std::map<size_t, size_t> atomIdMap;
|
---|
| 73 |
|
---|
| 74 | /**
|
---|
| 75 | * Maps original atom IDs received from the parsed file to atom IDs in the
|
---|
| 76 | * world.
|
---|
| 77 | */
|
---|
| 78 | std::set<size_t> SerialSet;
|
---|
| 79 |
|
---|
[3ae731] | 80 | };
|
---|
| 81 |
|
---|
| 82 | #endif /* PDBPARSER_HPP_ */
|
---|