Victor
 All Data Structures Functions Variables Friends Pages
LigandSet.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 _LigandSet_H_
18 #define _LigandSet_H_
19 
20 
21 // Includes:
22 #include <Bond.h>
23 #include <Polymer.h>
24 #include <Ligand.h>
25 #include <Visitor.h>
26 #include <AminoAcidCode.h>
27 
28 // Global constants, typedefs, etc. (to avoid):
29 
30 namespace Victor { namespace Biopool {
31 
37  class LigandSet : public Polymer {
38  public:
39 
40 
41  // CONSTRUCTORS/DESTRUCTOR:
42  LigandSet();
43  LigandSet(const LigandSet& orig);
44  virtual ~LigandSet();
45 
46  // PREDICATES:
47 
48  int getStartOffset() {
49  return startOffset;
50  }
51 
52  virtual string getClassName() const {
53  return "LigandSet";
54  }
55  Ligand& getLigand(unsigned int n);
56  const Ligand& getLigand(unsigned int n) const;
57  bool isGap(int index);
58  const unsigned int sizeLigand() const;
59 
60  unsigned int maxPdbNumber() {
61  return startOffset + gaps.size() + sizeLigand();
62  }
63 
64  // MODIFIERS:
65  void addGap(int index);
66  void insertComponent(Component* g);
67  void removeLigand(Ligand* g);
68  void deleteLigand(Ligand* g);
69 
70  void setStartOffset(int _offset) {
71  startOffset = _offset;
72  }
73 
74  void copy(const LigandSet& orig);
75 
76  inline void setTrans(vgVector3<double> t);
77  inline void addTrans(vgVector3<double> t);
78  inline void setRot(vgMatrix3<double> r);
79  inline void addRot(vgMatrix3<double> r);
80 
81  void load(Loader& l); // data loader
82  void save(Saver& s); // data saver
83 
84  virtual LigandSet* clone();
85 
86  // OPERATORS:
87  LigandSet& operator=(const LigandSet& orig);
88  Ligand& operator[](unsigned int n);
89  const Ligand& operator[](unsigned int n) const;
90 
91  protected:
92 
93  // HELPERS:
94  void resetBoundaries();
95  // ATTRIBUTES
96  int startOffset;
97  vector<int> gaps; //to keep trace of gaps in the pdb file
98 
99  private:
100 
101  };
102 
103  // ---------------------------------------------------------------------------
104  // LigandSet
105  // -----------------x-------------------x-------------------x-----------------
106 
107  // MODIFIERS
108 
109  inline void
110  LigandSet::setTrans(vgVector3<double> t) {
111  if (sizeLigand())
112  getLigand(0).setTrans(t);
113  }
114 
115  inline void
116  LigandSet::addTrans(vgVector3<double> t) {
117  if (sizeLigand())
118  getLigand(0).addTrans(t);
119  }
120 
121  inline void
122  LigandSet::setRot(vgMatrix3<double> r) {
123  if (sizeLigand())
124  getLigand(0).setRot(r);
125  }
126 
127  inline void
128  LigandSet::addRot(vgMatrix3<double> r) {
129  if (sizeLigand())
130  getLigand(0).addRot(r);
131  }
132 
133  inline void
134  LigandSet::load(Loader& l) {
135  l.loadLigandSet(*this);
136  resetBoundaries();
137  }
138 
139  inline void
140  LigandSet::save(Saver& s) {
141  s.saveLigandSet(*this);
142  }
143 
144  inline const unsigned int
145  LigandSet::sizeLigand() const {
146  return components.size();
147  }
148 
149  inline Ligand&
150  LigandSet::getLigand(unsigned int n) {
151  // ERROR("Not implemented yet!",exception);
152  if (n > components.size() - 1)
153  ERROR("Index out of range", exception);
154  return *(dynamic_cast<Ligand*> (components[n]));
155  }
156 
157  inline const Ligand&
158  LigandSet::getLigand(unsigned int n) const {
159  // ERROR("Not implemented yet!",exception);
160  if (n > components.size() - 1)
161  ERROR("Index out of range", exception);
162  return *(dynamic_cast<const Ligand*> (components[n]));
163  }
164 
165  inline void
166  LigandSet::removeLigand(Ligand* l) {
168  setModified();
169  }
170 
171  inline void
172  LigandSet::deleteLigand(Ligand* l) {
174  setModified();
175  }
176 
177 
178  // OPERATORS:
179 
180  inline Ligand&
181  LigandSet::operator[](unsigned int n) {
182  return getLigand(n);
183  }
184 
185  inline const Ligand&
186  LigandSet::operator[](unsigned int n) const {
187  return getLigand(n);
188  }
189 
190  // HELPERS:
191 
192 }} //namespace
193 #endif //_LigandSet_H_
194 
195 
196 
197 
198 
199 
200 
bool isGap(int index)
Definition: LigandSet.cc:64
Base class for saving components (Atoms, Groups, etc.).
Definition: Saver.h:39
void insertComponent(Component *g)
Definition: LigandSet.cc:118
Base class for composite structures.
Definition: Component.h:39
Base class for loading components (Atoms, Groups, etc.).
Definition: Loader.h:39
class implements methods to manage the ligandSet
Definition: LigandSet.h:37
Implements methods to manage a polymer created by components.
Definition: Polymer.h:33
void addGap(int index)
Definition: LigandSet.cc:88
virtual void deleteComponent(Component *c)
Definition: Polymer.cc:109
virtual void removeComponent(Component *c)
Definition: Polymer.cc:81
Implements methods to verify the ligand properties.
Definition: Ligand.h:38
virtual LigandSet * clone()
Definition: LigandSet.cc:51