[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>
|
---|
| 12 | #include "Parser/FormatParser.hpp"
|
---|
| 13 |
|
---|
| 14 | /**
|
---|
[bb6193] | 15 | * Known keys for the Pdb line.
|
---|
[3ae731] | 16 | */
|
---|
[bb6193] | 17 | class PdbKey {
|
---|
[3ae731] | 18 | public:
|
---|
[bb6193] | 19 | enum PdbDataKey {
|
---|
[3ae731] | 20 | noKey,
|
---|
| 21 | x,
|
---|
| 22 | Id,
|
---|
| 23 | Type,
|
---|
| 24 | extType,
|
---|
| 25 | name,
|
---|
| 26 | resName,
|
---|
| 27 | chainID,
|
---|
| 28 | resSeq,
|
---|
| 29 | occupancy,
|
---|
| 30 | tempFactor,
|
---|
| 31 | segID,
|
---|
[bb6193] | 32 | charge
|
---|
[3ae731] | 33 | };
|
---|
| 34 | };
|
---|
| 35 |
|
---|
| 36 | /**
|
---|
| 37 | * Holds tremolo-specific information which is not store in the atom class.
|
---|
| 38 | */
|
---|
[bb6193] | 39 | class PdbAtomInfoContainer {
|
---|
[3ae731] | 40 | public:
|
---|
[bb6193] | 41 | PdbAtomInfoContainer();
|
---|
| 42 | void set(PdbKey::PdbDataKey key, std::string value);
|
---|
| 43 | std::string get(PdbKey::PdbDataKey key);
|
---|
[3ae731] | 44 | std::string name;
|
---|
[bb6193] | 45 | std::string extType;
|
---|
[3ae731] | 46 | std::string resName;
|
---|
| 47 | std::string chainID;
|
---|
| 48 | std::string resSeq;
|
---|
| 49 | std::string occupancy;
|
---|
| 50 | std::string tempFactor;
|
---|
| 51 | std::string segID;
|
---|
| 52 | std::string charge;
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | /**
|
---|
| 56 | * Loads a tremolo file into the World and saves the World as a tremolo file.
|
---|
| 57 | */
|
---|
| 58 | class PdbParser : public FormatParser
|
---|
| 59 | {
|
---|
| 60 | public:
|
---|
| 61 | PdbParser();
|
---|
| 62 | ~PdbParser();
|
---|
| 63 | void load(std::istream* file);
|
---|
| 64 | void save(std::ostream* file);
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | private:
|
---|
| 68 | void readAtomDataLine(string line);
|
---|
| 69 | void parseAtomDataKeysLine(string line, int offset);
|
---|
| 70 | void readNeighbors(std::stringstream* line, int numberOfNeighbors, int atomId);
|
---|
| 71 | void processNeighborInformation();
|
---|
| 72 | void adaptImprData();
|
---|
| 73 | void adaptTorsion();
|
---|
| 74 | std::string adaptIdDependentDataString(std::string data);
|
---|
| 75 | bool isUsedField(std::string fieldName);
|
---|
| 76 | void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom);
|
---|
[bb6193] | 77 | void saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResdueNo);
|
---|
[21585f] | 78 | int getAtomId(int atomid) const;
|
---|
| 79 | void setAtomId(int localatomid, int atomid);
|
---|
[3ae731] | 80 |
|
---|
| 81 | /**
|
---|
| 82 | * Map to associate the known keys with numbers.
|
---|
| 83 | */
|
---|
[bb6193] | 84 | std::map<std::string, PdbKey::PdbDataKey> knownKeys;
|
---|
[3ae731] | 85 |
|
---|
| 86 | /**
|
---|
| 87 | * Data which is currently not stored in atoms but was provided by the input
|
---|
| 88 | * file.
|
---|
| 89 | */
|
---|
[bb6193] | 90 | std::map<int, PdbAtomInfoContainer> additionalAtomData;
|
---|
[3ae731] | 91 |
|
---|
| 92 | /**
|
---|
| 93 | * Default additional atom data.
|
---|
| 94 | */
|
---|
[bb6193] | 95 | PdbAtomInfoContainer defaultAdditionalData;
|
---|
[3ae731] | 96 |
|
---|
| 97 | /**
|
---|
| 98 | * Maps original atom IDs received from the parsed file to atom IDs in the
|
---|
| 99 | * world.
|
---|
| 100 | */
|
---|
| 101 | std::map<int, int> atomIdMap;
|
---|
| 102 | };
|
---|
| 103 |
|
---|
| 104 | #endif /* PDBPARSER_HPP_ */
|
---|