Victor
 All Data Structures Functions Variables Friends Pages
PdbSaver.h
1 /* This file is part of Victor.
2 
3  Victor is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Victor is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with Victor. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _PDB_SAVER_H_
18 #define _PDB_SAVER_H_
19 
20 // Includes:
21 #include <Group.h>
22 #include <SideChain.h>
23 #include <AminoAcid.h>
24 #include <Spacer.h>
25 #include <LigandSet.h>
26 #include <Ligand.h>
27 #include <Saver.h>
28 #include <Debug.h>
29 #include <string>
30 #include <iostream>
31 #include <Protein.h>
32 // Global constants, typedefs, etc. (to avoid):
33 
34 namespace Victor { namespace Biopool {
35 
39  class PdbSaver : public Saver {
40  public:
41 
42  // CONSTRUCTORS/DESTRUCTOR:
47  PdbSaver(ostream& _output = cout)
48  : output(_output), writeSeq(true), writeSecStr(true), writeTer(true),
49  atomOffset(0), aminoOffset(0), ligandOffset(0), chain(' ') {
50  }
51  // this class uses the implicit copy operator.
52 
53  virtual ~PdbSaver() {
54  PRINT_NAME;
55  }
56 
57  // PREDICATES:
58 
59  void endFile() {
60  output << "END\n";
61  }
62 
63  // MODIFIERS:
64 
65  void setWriteSecondaryStructure() {
66  writeSecStr = true;
67  }
68 
69  void setDoNotWriteSecondaryStructure() {
70  writeSecStr = false;
71  }
72 
73  void setWriteSeqRes() {
74  writeSeq = true;
75  }
76 
77  void setDoNotWriteSeqRes() {
78  writeSeq = false;
79  }
80 
81  void setWriteAtomOnly() {
82  writeSecStr = false;
83  writeSeq = false;
84  writeTer = false;
85  }
86 
87  void setWriteAll() {
88  writeSecStr = true;
89  writeSeq = true;
90  writeTer = true;
91  }
92 
93  void setChain(char _ch) {
94  chain = _ch;
95  }
96  virtual void saveGroup(Group& gr);
97  virtual void saveSideChain(SideChain& sc);
98  virtual void saveAminoAcid(AminoAcid& aa);
99  virtual void saveSpacer(Spacer& sp);
100  virtual void saveLigand(Ligand& l);
101  virtual void saveLigandSet(LigandSet& l);
102  virtual void saveProtein(Protein& prot);
103 
104  protected:
105 
106  private:
107 
108  // HELPERS:
109  void writeSeqRes(Spacer& sp); // writes SEQRES entry
110  void writeSecondary(Spacer& sp);
111  // writes secondary entries (SHEET, HELIX, etc.)
112  // ATTRIBUTES
113  ostream& output; // output stream
114  bool writeSeq, writeSecStr, writeTer;
115  unsigned int atomOffset, ligandOffset;
116  int aminoOffset;
117  char chain; // chain ID
118  // offsets that determine at which atom, aminoacid and ligand number to start
119  };
120 
121 }} //namespace
122 #endif //_PDB_SAVER_H_
123 
124 
virtual void saveProtein(Protein &prot)
Definition: PdbSaver.cc:244
Base class for saving components (Atoms, Groups, etc.).
Definition: Saver.h:39
virtual void saveGroup(Group &gr)
Definition: PdbSaver.cc:37
virtual void saveLigand(Ligand &l)
Definition: PdbSaver.cc:169
virtual void saveLigandSet(LigandSet &l)
Definition: PdbSaver.cc:228
virtual void saveAminoAcid(AminoAcid &aa)
Definition: PdbSaver.cc:90
Saves components (Atoms, Groups, etc.) in standard PDB format.
Definition: PdbSaver.h:39
PdbSaver(ostream &_output=cout)
Definition: PdbSaver.h:47
virtual void saveSpacer(Spacer &sp)
Definition: PdbSaver.cc:99
virtual void saveSideChain(SideChain &sc)
Definition: PdbSaver.cc:81